Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

GroupSeparator (BIRT)

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

Introduction

This example illustrates adding a group separator using JavaScript and a second detail row.

BIRT Version Compatibility

Enter the version of BIRT that was used to build the example.

Example Files

Example Report Zipped

Description

This example demonstrates how a group separator can be created using Script Event Handlers. The group separator in this example is an extra detail row every 3 rows within a group. This extra detail row has border formatting. This was done by first adding the sample customers table to a report and grouping on country. We set the page break to break after a group, so for every new group we get a new page. Within a given page we want to display a breaker or interval row that has no data just some formatting. So we inserted a second detail row and applied formatting.

Next the following script was added to the beforeOpen event.

internalGroupCount = 0;

This is our current in group row count that we calculate manually.

The onCreate script of the first detail row was then set to:

if( internalGroupCount > 2 ){
   internalGroupCount = 0;
}

This resets our internal group row counter every three rows.

Next the onCreate script for the second detail (Breaker) Row was set to:

internalGroupCount = internalGroupCount + 1;

This increments the internal group row counter.

We then add a visibillity expression to the second detail (Breaker) row with the following expression.

if( internalGroupCount  < 2 ){
   true;
}else{
   false;
}

This hides the second detail (Breaker) row until three first detail rows have been processed. Note that hidding the second detail row does not prevent its onCreate script from running.

Lastly the group row counter should be reset when a page break occurs. This was done by selecting the date in the footer on the master page and entering the following in the onCreate script.

internalGroupCount = 0;


Comments

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