JDONE trying to get fields to not print when there's no data

i am happy with the template i have created, except that it does not seem to want to ommit certainreport itemswhen they have no data, i have tried deselecting the print on empty data source option but no joy, please help, see file attatched, the report items in question are as follows: itemrepair, itemrepairshipping, and loan

any help would be greatly appreciated

rich

Hi Rich

The other bands havespecific 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: dir=ltr " ">

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: dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{

[i]//*************************
//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
//**************************
[/i]

}

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 dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//*************************
//Don’t print band if there is no data:

[i]object o=DetailReportItemMiscExpense.GetCurrentColumnValue(“ID”);
&nbs