RSS
 

BIRT DESIGNER-Hide/Show a component

01 oct

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.

 
4 Comments

Posted by Cyril Balit in Anglais, Eclipse, Java

 

Tags: , ,

  • http://birtworld.blogspot.com scott rosenbaum

    Why would you not just use the following in expression in the visibility

    Total.count() == 0

    That should do it.

  • http://rialto.improve-technologies.com/wiki/rialto Cyril Balit

    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

  • http://www.birt-exchange.com Virgil

    Hi Cyril,

    Thanks for posting your tip on hiding elements based on computed columns. I’ve added a link to this post at BIRT Exchange for others to find.

  • http://www.usps.com augustine okorie junior

    SIR
    HOW CAN ONE MAKE CLIAMS FROM THE COMPUTERS CAUSE I HAVE ALOT OF DISOWNED PROPERTY IN THIS INTERNAT .
    THANKS
    AUGUSTINE OKORIE JUNIOR
    CNN-NIGERIA