Jump to content

BIRT Developer Center Download


Photo
- - - - -

BIRT - Hiding Empty Fields on a Report


  • Please log in to reply
No replies to this topic

#1 paulbappoo

paulbappoo

    Junior Member

  • Members
  • PipPip
  • 12 posts

Posted 30 March 2010 - 12:24 AM

Get a full PDF copy of this guide, with screen shots, free at BIRT Reporting Articles, News and Support.

INTRODUCTION

Recently I needed to create a purchase order report and one of the challenges I found whilst doing this was that I needed to create an address block at the top of the report for the suppliers address. In itself this was easy of course, I just placed my address fields, one after the other in a grid cell.

But I found that some of the supplier addresses did not use all the fields available and the result was that I had gaps in my address block where the blank fields were.

It appears that there are a number of ways to solve this problem, I looked on the forums and found many solutions. In this quick guide I present the quickest and easiest method that I found so you too can have well formatted addresses, or for that matter any other data that requires blank fields to be removed from the report layout at run time.

THE PROBLEM

I have a report with an address block. Typically this could be a purchase order, an invoice or a supplier/customer listing.

In my case it was a purchase order, here is a screenshot of the report layout, showing the address block.

You can see that I have created a grid and populated the cells with the address fields from my database.

When the report is executed, any fields in the address block where there is no data, leave an ugly gap, as in the following screen shot.

THE VISIBILITY PROPERTY

In order to make the address fields disappear when not populated with data, we can use the field visibility property.

Select the field you wish to hide when empty and from the properties section in the lower portion of the screen, select the visibility tab.

Check the box “Hide element” and select the radio button “for all outputs”
Note that you can elect to hide empty fields for specific output types, by selecting the radio button “for specific outputs” this then allows you to select which output formats will behave in this way and which wont, as per the following screen shot.

Once you have selected the output style to be affected, select the function button to the left of the Expression field.

And you will see the expression builder.

Enter the formula as follows:

row["Address1"]==""|| row["Address1"]==null

Where Address1 is the name of the field whose properties you are currently editing.

Here is the expression builder for the Address1 field, with the formula entered.

Now when the report is executed, any blank fields vanish and all the other fields are moved up to fill the gap.

MORE INFORMATION

BIRt for Beginners, written by Paul Bappoo, the founder of the BIRT User Group UK presents an overview of the open source BIRT tools and the commercial enhancements available from Actuate, including...

Eclipse BIRT Designer, Actuate BIRT Designer, iServer Express, Interactive BIRT viewer, Actuate BIRT Studio, BIRT Spreadsheet Designer

With walkthrough tutorials of the main features, including screenshots, from installation through data selection to formatting reports and fully graphical Flash charting this book will have you creating your own reports from scratch in only a couple of hours.

If you are too busy to spend days learning software and want tangible results fast then BIRT For Beginners is for you.

When you buy the book you will automatically get access to the readers section of this web site which includes BIRT report request forms that you can distribute to your end users, extra chapters in PDF format and an ever growing library of reports, tutorials, reviews, tips & tricks.

Buy the book and get free membership of BIRT Reporting and the BIRT User Group UK at:

BIRT Reporting Articles, News and Support

Please feel free to share this address with your colleagues and inspire them to use BIRT to create great looking reports.

I look forward to your feedback so please feel free to send me an email and let me know how you get on with BIRT, provide feedback on this guide, share your tips and tricks, or request help for specific problems. I can’t guarantee to personally solve everyone’s problems but there are some great BIRT related forums out there and you can find a growing list of links and resources on my site.

Paul Bappoo
Paul@BirtReporting.com
BIRT Reporting Articles, News and Support