Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Add Map Rule in beforeFactory (BIRT)

< To: Report Developer Examples (BIRT)
This example is Bugzilla ID 182030. 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 MAP rule to the report element.

The beforeFactory script is listed below.


delm = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("QTYELEMENT");
mr = StructureFactory.createMapRule();
mr.setDisplay("A lot");

ph = delm.getPropertyHandle(StyleHandle.MAP_RULES_PROP);

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 mr variable is a map rule that is created using the DE API Structure Factory. The map rule is then applied to the data element using a Property Handle.

In this example the quantity field displays "A lot" when the quantity ordered is over 40.


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