How to write a script to not print Blank fields

"We have written a Workorder summary template that prints the Workorder

?Item Summary? and the Labor ?Service Details? for each labor field

entered into a workorder. Many times there is multiple labor entries

made to keep close track of the time spent at a job site. Often our

personnel will enter details of the work performed at a site into only

one of the ?Service Details? fields available to them. The remaining

labor ?service details? fields are left blank. When the workorder

prints, each of the labor entries is printed along with a text field

containing the service details. If there were three labor fields

entered then three lines of time and service details is printed. If no

text was entered into a service details field a blank default area is

still printed. This takes up a lot of unused space on the page.

We want to write a script that looks at the labor ?service details?

field and if it contains no text then we want to skip over the printing

of that field. Some of the sample templates do something similar to

this when they skip the printing of a parts summary when no parts are

used in a workorder. We tried modifying those scripts with no success.

Hope you can help."


  1. Please export your report template to file (see AyaNova 4 Help file on this (URL removed as for older version no longer supported - see the latest version of AyaNova)

  2. Then zip up that file using WinZipand attach to a reply to this post.

Always attach a copy of the report template you have a question abour so that I can see it directly and answer directly for that particular report template.

  • Joyce

Attached to this post is a copy of the workorder report in question.

Thnk you for posting the report template. I will download, import and take a look and post back.

  • Joyce

Hi again

Download CopyClientWorkReport_1.zipand import

Open the report template in the designer

View the OnBeforePrint script for Detail4 band (for labor)

You will see that it now has the script as follows: dir=ltr " ">

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

//the first line converts the object Service Details to a string
//the second line checks to see if the string is empty or not
//if the string is empty (no Service Details are entered) than teh band is told not to display

string s=Convert.ToString(DetailReport4.GetCurrentColumnValue(“LT_WorkorderItemLabor_Label_ServiceDetails”));
}<P dir=ltr " ">I tested it here with a workorder that had multiple labor records, and ensured that it did not display the records that had empty Service Details field.<P dir=ltr " ">Let me know you received.<P dir=ltr " ">- Joyce


Your script works great. Thank you.

Question? When we started working on this problem we went to the Devexpress web site and reviewed their online documentation for XtraReports. Even thought their online documentation is extensive I had trouble finding a method or function that would work for us in AyaNova.

What do you use as reference documentation when you are looking for methods, function, and properties?


Hi Glenn

DevExpress is the actual reporting component itself - whereas scripts etc are entered in C# language.

DevExpress provides details about their component only, but for C# scripts I usually perform a search online (i.e. Google) entering in text such as C# and whatever it is that I am trying to do - for example to get me started I entered the text C# string empty in a Google search as I was looking for how to determine if a string is empty and read over the results to get ideas and examples, and than tested it to get successful results.

  • Joyce