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)
Table with Filtered Data
Davolio
What I am trying to do is make my table look like this:<br />
<br />
<strong class='bbc'>User Role Task Shift</strong><br />
Dave Prog Code First<br />
<blank> Mang Fire Second<br />
Chad Prog Code First<br />
<blank> <blank> Test Second<br />
<br />
<br />
What it looks like now:<br />
<strong class='bbc'>User Role Task Shift</strong><br />
Dave Prog Code First<br />
Dave Mang Fire Second<br />
Chad Prog Code First<br />
Chad Prog Test Second<br />
<br />
I'm using BIRT report designer 2.2.1 I just downloaded the all in one, I've only been at this for like a week, I'm a previous cognos user. <br />
<br />
In simplest terms I want the cell to be blank if the cell above it has it's same value. <br />
<br />
so I've been trying to create a script to do this but they have all been rather unsuccessful. I figured i'd have to do it on a Cell by Cell basis so for each Cell I created a script during the oncreate which is something like:<br />
<br />
If (prevCell == this.getRow().getColumnValue("USER"))<br />
{ <br />
-- set the cell to be blank<br />
}<br />
<br />
prevCell = this.getRow().getColumnValue("USER");<br />
<br />
my main issue is how do I set the cells value ? And how do I set the global. I have a book that says how to do it but the book is wrong, I think I should be using the reportContext.setGlobalVariable(arg1, arg2).<br />
When trying to set the cell's value I do a <strong class='bbc'>this. </strong>The only methods I can find are get methods, no set methods. I didn't find what I needed in the report context either. Maybe manipulating the table isn't the answer maybe I should be doing this via the dataset. I don't know. I don't suppose there's any way to iterate through a table in BIRT like you can a spreadsheet in EXCEL VB or something?<br />
<br />
Any help would be greatly appreciated,<br />
<br />
Thanks,<br />
<br />
Dave
Find more posts tagged with
Comments
mwilliams
Hi Dave,<br />
<br />
Assuming your data is sorted like you want it when it comes in, you should be able to do this by using dynamic text elements rather than dragging the dataSet elements over into the table. You'd just have to put variable for each of your output columns in the initialize script of the report (i.e. lastUser = ""; lastRole = ""; etc.). Then in the dynamic text box in the detail row for each column, do something like the following:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (row["Column_Name"] == lastColumn_Name){
"";
}
else {
lastColumn_Name = row["Column_Name"];
row["Column_Name"];
}
</pre>
<br />
If you want the first line for each user to always contain all data elements, you'll have to add a little more script to check for the username being the same as the last for all columns.<br />
<br />
I haven't tested this, but it should work. Let me know if it doesn't.
Davolio
Nice Thanks M.
I figured out a way lol. I've been banging my head on this two days and then after I post I thought of something. I've been having trouble getting that row stuff to work so here's what I did. I used text boxes in my table and bound my dataset to the table.
I then run this script onCreate for each Cell.
this.text = this.getRowData().getColumnValue("USER_ID");
if(this.text.equals(reportContext.getGlobalVariable("prevUserId")))
{
this.text = "";
}
else
{
reportContext.setGlobalVariable("prevUserId",this.text);
}
I think I might try your way though because if I can do it without creating globals that would be nice . I must not be able to assign when I do the row["USER_ID"] because they are dataset items or something... but If I make them Text or dynamic text it should work.
Thanks
Dave
Virgil Dodson
Hi Dave,
There is also a built in feature for the table columns that allow for suppressing duplicates without using scripting. To get this, select an entire column for a table control, then in the Property Editor, select the Property tab and then General. A check box at the bottom, right allows you to Suppress Duplicates.
Davolio
Nice! no sense in reinventing the wheel. Thanks for the info, I can't believe I missed that property!
mwilliams
Oops! I skipped right over the easy solution and made it harder than it really was.
murphster
<blockquote class='ipsBlockquote' data-author="'vdodson'" data-cid="38643" data-time="1225227720" data-date="28 October 2008 - 02:02 PM"><p>
Hi Dave,<br />
<br />
<br />
There is also a built in feature for the table columns that allow for suppressing duplicates without using scripting. To get this, select an entire column for a table control, then in the Property Editor, select the Property tab and then General. A check box at the bottom, right allows you to Suppress Duplicates.<br /></p></blockquote>
<br />
With regards to the suppress duplicates checkbox. Fro mwhat I can see this can only be applied at column or row level. Im working on a report that requires suppress duplicates on some of the cells in the column, 1 of the cells(group total cell) needs to be unsuppressed.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/19942-suppress-duplicates-on-cell-level-not-column-level/'>My
Example</a>
mwilliams
murphster,
I responded in your other post.