How to remove blank address lines using Fast Reports.

Fast Reports is an excellent reporting tool for Delphi programmers and there is a missing feature that was in SAP Crystal Reports.

The property to remove a blank line in an address block. Fast Reports has grown over the last 2 versions making the reporting for Windows and Web one of the best software tools there is available.

Usually the address block consists of a company name, contact person, address and the city, state or province and a zip code or postal code.

Simple way to remove blank lines

One simple method of checking whether the contact person exists or there is a blank line is the following code using Fast Reports version 6 for VCL:

  1. Insert a text object on the report page where you wish the address block to be printed from.
  2. The “Text” object has the “HideZeros” property which can be used to hide zero values. This is dependent on how you retrieve the data.
  3. Open the text object
Fast Report Script to check for empty lines

4. Write the script [IIF (Trim(<Dataset_Name."Contact_Name">) <> '', <Dataset_Name."Contact_Name">+#13#10+<Dataset_Name."Address1">+#13#10+<Dataset_Name."Address2">, <Dataset_Name."Address1>+#13#10+<Dataset_Name."Address2">)]

5. Click OK to save the script. Note: Change the Dataset_Name to your Dataset Name.

The breakdown of the conditional above is based whether the contact name exists.

There are some software developers that can create a routine to call to parse but you have the choice of a simple approach or as describe earlier you can use the data query to extract the information into a single address block data line.

Hopefully in a future Fast Reports release they will have a property to do so but until then you can use the method above or build the address block with the query that creates the data set.

You can always check with Baron Software for any type of software development you need today.