BIRT DESIGNER-Hide/Show a component

On a project using BIRT I was confronted with this problem. I generate complex reports using components and datasets defined in a library. I wish to show a component only if the bound dataset contains data.
The operation is simple but I looked for the most generic solution. Indeed the component will be used in some reports and the update operations have to be the simplest as possible.
First of all it is necessary to distinguish two situations:

  1. Dataset that contain only one set of data (characteristics of a customer for example)
  2. Dataset multi-lines (customers list)

I used Birt Designer to configure the various elements.

  1. Dataset with one record

You have to add to the dataset a column which will represents the visible status of the bound component. Edit the dataset properties and create a computed columns by clicking on new

Then you have to set:

  • The name of the column (isVisible for example)
  • Its type: boolean

Then you have to build the expression allowing to test the other columns:

  • Click on fx
  • Build the expression by testing the wished columns

2. Dataset with multi-lines

First you have to create a computed column with the following attributes:

  • name : length
  • Data type : integer
  • Aggregation : COUNT

We create then an « isVisible » column which test the value of the column lenght with the following expression :

row [« length »]!=0

3. Visible status of the component

In the tab properties and in the visibility column

  • Select the « Hide element  » checkbox
  • Set the expression field with the value: ! Row [ » isVisible « ]

If the return value is true the component is not display in the report.

6 réflexions sur « BIRT DESIGNER-Hide/Show a component »

  1. You are true. we can use the « Total.count()==0 » expression. But not in the visible expression of the component but in the isVisible column expression. That will ease update operations

  2. that not correct it’s not hide at run time … give me proper solution

Les commentaires sont fermés.