Highlight duplicates in a table

kclarkkclark BIRT GuruEM
edited December 6, 2013 in DevShare Downloads
Example showing how to highlight duplicate data in a table using a highlight rule and an ArrayList.



I create an ArrayList in the beforeOpen of my data set.
array = new java.util.ArrayList();


Then I had to store the values of the column I wanted to check for later in the onFetch()
array.add(row["QUANTITYORDERED"]);


I also had to store this ArrayList as a global persistent variable from afterClose()
reportContext.setPersistentGlobalVariable("array", array);


Now that all the values are stored I can use the following scripts as expressions from the highlight rule UI.
var array = reportContext.getPersistentGlobalVariable("array");
var first   = array.indexOf(row["QUANTITYORDERED"]);
first;


Not Equal to
var array = reportContext.getPersistentGlobalVariable("array");
var last   = array.lastIndexOf(row["QUANTITYORDERED"]);
last;


highligh_duplicates.png

Kristopher Clark

Actuate Corporation – The BIRT Company™

http://www.actuate.com | http://birtondemand.com

 

My Blog

Twitter

LinkedIn
Facebook
 

Sign In or Register to comment.