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

Difference between revisions of "Alternate Color On Group Rows (BIRT)"

(New page: {{Backlink|Report Developer Examples (BIRT)}} This example is [https://bugs.eclipse.org/bugs/show_bug.cgi?id=212627 Bugzilla ID 212627]. If you would like to contribute an example see the...)
 
(Description)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
 
This example was built and tested with BIRT 2.2.1.1.
 
This example was built and tested with BIRT 2.2.1.1.
 
== Example Files==  
 
== Example Files==  
[https://bugs.eclipse.org/bugs/attachment.cgi?id=84989 Example Report Zipped]  
+
[https://bugs.eclipse.org/bugs/attachment.cgi?id=102645 Example Report]
 +
 
 
== Description==  
 
== Description==  
In order to make this work, you need to alternate the value of a global variable.  This is best done in the OnRender method of the DataRow that is showing the Group information.
+
In order to make this work, you need to alternate the value of a global variable.  This is best done in the OnCreate method of the table row that is showing the Group information.
 
  if (reportContext.getGlobalVariable("alt_grp") == false)
 
  if (reportContext.getGlobalVariable("alt_grp") == false)
 
     reportContext.setGlobalVariable("alt_grp", true);
 
     reportContext.setGlobalVariable("alt_grp", true);

Latest revision as of 10:32, 29 May 2008

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

Introduction

This illustrates using highlight rules to alternate the backgroundColor of the row that displays header data. In some reports, there is no detail information. All of the information is contained in the group headers. For clarity, it is nice to have the group headers alternate colors. This example shows how to do that.

BIRT Version Compatibility

This example was built and tested with BIRT 2.2.1.1.

Example Files

Example Report

Description

In order to make this work, you need to alternate the value of a global variable. This is best done in the OnCreate method of the table row that is showing the Group information.

if (reportContext.getGlobalVariable("alt_grp") == false)
    reportContext.setGlobalVariable("alt_grp", true);
else
    reportContext.setGlobalVariable("alt_grp", false);

Then all you need to do is add a highlight rule on the row. In the If following condition field enter

reportContext.getGlobalVariable("alt_grp")

And in the condition drop-down select "is true". Then just apply the format rules you would like for the alternate groups.

Comments

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


Copyright © Eclipse Foundation, Inc. All Rights Reserved.