Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Highlighting rows when multiple rows match
rwoolf
<p>I am needing to highlight two or more rows in a table when the data in multiple rows is the same.</p>
<p> </p>
<p>Two of the columns in the table are needing to be watched. One is a date column and another is a "item type" (String) column. I have a situation where on any given date there should only be one "item type" of "X". So if there are two or more rows where both have the same date, and an item of "X" then I want to highlight the row that it is visible that there is a situation that is out of compliance.</p>
<p> </p>
<p>The only static is the item type. The date can be any date and I am needing to just watch for items that have the same date and the item X.</p>
<p> </p>
<p>I'm hoping there is some way to script for this, but I have no clue how to begin. Any help would greatly be appreciated. </p>
Find more posts tagged with
Comments
micajblock
<p>Can you provide sample data and version of BIRT you are using?</p>
rwoolf
<div>Version: 4.6.0.v201606072122</div>
<div>Build id: v20160607-2112</div>
<div> </div>
<div>The data is coming from a POJO data source that is getting the data from a Lucene Index.</div>
<div> </div>
<div>There are five columns of data: Invoice (string), Service Date (date), Service Type (string), Service Description (string), and Service Amount (string). The table is grouped on "Invoice" so that it only shows once and there are then multiple rows showing the service data and other data. The data can be similar to:</div>
<div> </div>
<div><strong>abc113, 1/1/2017, Consultation (1st hour),Talked about..., 75</strong></div>
<div>abc113, 1/1/2017, Preparation, Gathered info..., 50</div>
<div><strong>abc113, 1/1/2017, Consultation (1st hour), Some description..., 75</strong></div>
<div>
<div>abc113, 1/2/2017, Consultation (1st hour), Another Description..., 75</div>
<div> </div>
<div>Above shows two "Consultation (1st hour)" for the same date, which is in violation and so I want to highlight it so that it is easily seen. The third "Consultation (1st hour)" is not in violation because it is a different date. Only one "Consultation (1st hour)" is allowed per date.</div>
<div> </div>
</div>
micajblock
<p>First a suggestion from my colleague Clement Wong - <span style="font-size:10pt;font-family:arial, sans-serif;color:#000000;">Since you are using POJO and OS BIRT, I think you are using a scripted data set. So why not use a hashmap, do a comparison, and then put the result in a new column called “isDuplicate�</span></p>
<p> </p>
<p><span style="font-size:10pt;">In any case attached is an example with 2 ways of doing based on the requirement. In this example there are 2 tables. The first one only highlights the duplicate after the first one. The second table highlights all duplicates. They use different </span><span style="font-size:13.3333px;">methodologys</span><span style="font-size:10pt;">.</span></p>
<p> </p>
<p><span style="font-size:10pt;">In the first table:</span></p>
<ul><li><span style="font-size:10pt;">I have an array (typeArray) which will contain a concatenation of the type and the date. I have a data item the pushes this to the array. </span></li>
<li><span style="font-size:10pt;">I then have another data items which uses indexOf to fine if the type + date exists in the array.</span></li>
<li><span style="font-size:10pt;">I then use the above data item for my highlight rule.</span></li>
<li><span style="font-size:10pt;">I set visibility to hide on all the items I do not need to display.</span></li>
</ul><p> </p>
<p><span style="font-size:10pt;">In the second table:</span></p>
<ul><li><span style="font-size:10pt;">I group the data on the date field.</span></li>
<li><span style="font-size:10pt;">I create an aggregation that is the concatenation of all the types.</span></li>
<li><span style="font-size:10pt;">I then create a data item that will use the above aggregation to see if the type appears multiple times.</span></li>
<li><span style="font-size:10pt;">I then use the above data item for my highlight rule.</span></li>
<li><span style="font-size:10pt;">I set visibility to hide on all the items I do not need to display.</span></li>
</ul><p><span style="font-size:10pt;">Enjoy!</span></p>
<p> </p>
<div> </div>
rwoolf
<p>Thank you for your help.</p>