| Hi Rich The other bands have specific scripts that tell the report engine not to print those if no data. You need to apply OnBeforePrint scripts to each band type (different script if a GroupHeader or GroupFooter, than if a Detail band) along with referencing its main DetailReport band name, if you do not want it to print if no data just like the other bands already have. For example: Open your report template in the report designer Click on the GroupHeader3 band to select it (the band right under DetailReportItemMiscExpense) Expand the Scripts properites in the Properties band for this band See that there is a OnBeforePrint script for this band - you will see that the script for this GroupHeader3 band says: private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { //************************* //Don't print band if there is no data: object o=DetailReportItemMiscExpense.GetCurrentColumnValue("ID"); if(o==null) { e.Cancel=true; return; } System.Guid g=(System.Guid)o; if(g==Guid.Empty) e.Cancel=true;//cancel this print event //************************** }
If you click on the Detail6 band, and check its Scripts property, you will see it also has a OnBeforePrintScript slightly different: private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { //************************* //Don't print band if there is no data: //Get the id value of the record System.Guid g=(System.Guid)DetailReportItemMiscExpense.GetCurrentColumnValue("ID"); //See if it's empty: if(g==Guid.Empty) e.Cancel=true;//cancel this print event //************************** }
And if you click on the GroupFooter4 band and check its Script properties you will see it too also has a OnBeforePrint script similar to the GroupHeader3 band private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { //************************* //Don't print band if there is no data: object o=DetailReportItemMiscExpense.GetCurrentColumnValue("ID"); if(o==null) { e.Cancel=true; return; } System.Guid g=(System.Guid)o; if(g==Guid.Empty) e.Cancel=true;//cancel this print event //************************** }
And if you check the other bands for labor, parts, etc, you will also see that they too have OnBeforePrint scripts specifically referencing their DetailReport band 's groupheader, detail and groupfooter bands. Therefore what you need to do is enter in OnBeforeScripts for those bands for them not to print. BUT NOTE THE FOLLOWING Before you can set the ONBeforePrint scripts for the loan related bands, the DetailReport1 band for your loan bands is NOT actually referencing the specific WorkorderItemWorkorderItemLoan DataMember which is where it can get the loans data from. Right now it is not referencing anything, so you need to do that first. - click to select the DetailReport1 band
- View its Properties
- Drop down the DataMember field and select WorkorderItemWorkorderItemLoan by expanding the WorkorderHeader, than its WorkorderHeaderWorkorderItem, than selecting the WorkorderItemWorkorderItemLoan
- (note this would have been done automatically for you if you had set up the Detailreport band as outlined in the tutorial on creating detailed report templates)
Do note if you attempt to do this for the Outside service related bands, you will see that there is not a WorkorderItemWorkorderItemOutsideService DataMember. This is because Outside Service related fields are part of the WorkorderHeaderWorkorderItem DataMember. And because of this, if you try to use the OnBeforePrint scripts for these, if there is any data in the Workorder Item itself, those fields will still print even if those specific fields outside service fields are 0. It may be possible instead to create specific custom scripts created specifically for this report to check if for example if there is no vendor selected in Sent To, to not print. Please note that report design support is outside the realm of our free support for AyaNova. We have provided numerous support topics and solutions on this forum at no charge, but do note that this is at our discretion. If you would like additional support with this report template, I would be happy to send you a quote and link for payment. - Joyce
- AyaNova Sales & Technical Support
- http://www.ayanova.com
|