|
|
|
Forum Member
      
Group: Forum Members
Last Login: 9/18/2008 1:02:24 AM
Posts: 31,
Visits: 202
|
|
| Hi I wonder if you can help me as my knowledge on scripting is limited. I have created a custom field of type true/false for clients, and have generated a report which lists client names and this new custom field. What I would like to do is only print the Client where the custom field is True, and skip printing the line if it is either null or False. I have read through the manual and the section 'Preventing Bands from Displaying if a value is null' and tried looking through other reports. I've been trying to use the OnBeforePrint script on the band detailBand1 but with little success (lack of knowledge on C##). I've attached a copy of the test report minus any script code. Your help/advice would be appreciated. Regards - Brian
|
|
|
|
|
AyaNova Sales & Support
      
Group: Administrators
Last Login: 2 days ago @ 2:53:05 PM
Posts: 1,840,
Visits: 4,267
|
|
| Hi Brian I've downloaded a copy of your report template, and I'm going to have to think about this for a bit. Will get back to you as soon as I can. - Joyce
- AyaNova Sales & Technical Support
- http://www.ayanova.com
|
|
|
|
|
AyaNova Sales & Support
      
Group: Administrators
Last Login: 2 days ago @ 2:53:05 PM
Posts: 1,840,
Visits: 4,267
|
|
| Hi Brian It needed some funky stuff - I too had to ask for help from a C# guru. Download this new report template based on yours that only prints the fields in the detailBand1 if the custom field is equal to True. OnlyShowIfCustomFieldisTrue.zip I edited the OnBeforePrint script for the detailBand1 with the following: private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { //***************************************************************************** //first line below gets the value of the custom field, converts it to a string, checks to see //if it is empty or null - if empty or null, the priting of the detailBand1 is cancelled. //the second and third line determines that if the first line was actual false (was not empty or null) //then perform the third line which gets the string value of the custom field - if it is not True that is //converted to a bool value of true which means the detailBand1 also doesn't show. //****************************************************************************** e.Cancel = string.IsNullOrEmpty(GetCurrentColumnValue("LT_Client_Label_Custom8").ToString()); if (!e.Cancel) e.Cancel = !bool.Parse(GetCurrentColumnValue("LT_Client_Label_Custom8").ToString()); }
Let me know this now works for you - Joyce
- AyaNova Sales & Technical Support
- http://www.ayanova.com
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 9/18/2008 1:02:24 AM
Posts: 31,
Visits: 202
|
|
| Joyce, you're a star ------ it works a treat. Many Thanks Brian
|
|
|
|