AyaNova service management & work order software
AyaNova Support Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Skip line when boolean is false Expand / Collapse
Author
Message
Posted 1/30/2007 8:03:56 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 4/7/2008 4:27:34 AM
Posts: 31, Visits: 200
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

  Post Attachments 
Brian Test.zip (2 views, 11.35 KB)

Post #2682
Posted 1/30/2007 8:37:17 AM
AyaNova Sales & Support

AyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & Support

Group: Administrators
Last Login: Today @ 8:27:06 PM
Posts: 1,702, Visits: 4,008
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
Post #2683
Posted 1/30/2007 10:50:53 AM
AyaNova Sales & Support

AyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & Support

Group: Administrators
Last Login: Today @ 8:27:06 PM
Posts: 1,702, Visits: 4,008
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


  Post Attachments 
OnlyShowifCustomFieldisTrue.zip (2 views, 11.78 KB)
Post #2685
Posted 1/30/2007 11:10:54 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 4/7/2008 4:27:34 AM
Posts: 31, Visits: 200
Joyce, you're a star ------ it works a treat.

Many Thanks

Brian

Post #2686
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: AyaNova Sales & Support

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 9:32pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 10 queries. Compression Disabled.