Skip to main content
Jump to: navigation, search

Add Visibility Rule in beforeFactory (BIRT)

< To: Report Developer Examples (BIRT)
This example is Bugzilla ID 190059. If you would like to contribute an example see the example contribution guidelines.


This example illustrates calling the BIRT Design Engine API from the beforeFactory Script to add a map rule to a report element.

BIRT Version Compatibility

This example was built and tested with BIRT 2.1.2.

Example Files

Example Report Zipped


This example uses the DE API to locate a named report Data Element. Once located, the DE API is used to create and add a hide rule to the report element.

The beforeFactory script is listed below.


delm = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("QTYELEMENT");

hr = StructureFactory.createHideRule();
hr.setExpression("if( row[\"QUANTITYORDERED\"] > 30 ){true;}else{false;}");
ph = delm.getPropertyHandle("visibility");

The variable delm is set to the report element named QTYELEMENT. This means the data element in question must be named using the name property in the Property Editor. The hr variable is a hide rule that is created using the DE API Structure Factory. The hide rule is then applied to the data element using a Property Handle.

In this example the quantity field is hidden for values greater than 30.


Please enter comments below by selecting the edit icon to the right. You will need a Bugzilla account to add comments.

Back to the top