Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Simple Row Number for multiple groupings
kapadiatap
Hello Everyone,
I have around 1 week experience with Birt reporting , so sorry if this is a trivial question.
I have a report with multi-level groupings, but final report needs one column simply numbering each row.
Example:
Position Account number Account name Highest Balance Total Debit value Debit Volume Total Credit Value Credit Volume
1 12265452 Operating 1,194,965.17 1385438.32 1 1206784.38 2
4 12365456 Operating 636,728.84 1118741.44 1 1569302.01 3
8 12365457 Operating 511,754.52 0.00 0 511754.52 1
9 12365455 Operating 321,243.49 0.00 0 321243.49 1
For the position column above I am using the Function "RUNNINGCOUNT" on the "Table".
There are multiple groups with the account number group at the top of the hierarchy.
Isn't there anyway I can just display 1,2,3 etc for each row above?
~T~
Find more posts tagged with
Comments
mwilliams
In your initialize event of your report or in the onPrepare of your table, put:
groupCount = 0;
In your group header row's onCreate script, put:
groupCount++;
Then, drop a dynamic text box in your group header and put:
groupCount;
This should give you a count of 1,2,3,etc. for your groups. Hope this helps.
kapadiatap
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85403" data-time="1321483053" data-date="16 November 2011 - 03:37 PM"><p>
In your initialize event of your report or in the onPrepare of your table, put:<br />
<br />
groupCount = 0;<br />
<br />
In your group header row's onCreate script, put:<br />
<br />
groupCount++;<br />
<br />
Then, drop a dynamic text box in your group header and put:<br />
<br />
groupCount;<br />
<br />
This should give you a count of 1,2,3,etc. for your groups. Hope this helps.<br /></p></blockquote>
<br />
<br />
Thanks for your response.<br />
I am kind of new to Birt reporting.<br />
But can you please guide me as to how I can access the initialise event of the report and also the group header row's OnCreate script? <br />
I am using version 2.5.2.
mwilliams
Click anywhere in the design window that is not on an element and then click on the script tab under the design window to get to the initialize event. You'll see a drop down at the top that allows you to navigate between the report design script events.
To get to the table group header's script events, you select your table so that the tabs for the rows and columns appear. Then, you select the one next to your group header and then click on the script tab. Again, the drop down will be at the top of the page to allow you to go to the onCreate method.
Hope this helps!
kapadiatap
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85408" data-time="1321484305" data-date="16 November 2011 - 03:58 PM"><p>
Click anywhere in the design window that is not on an element and then click on the script tab under the design window to get to the initialize event. You'll see a drop down at the top that allows you to navigate between the report design script events.<br />
<br />
To get to the table group header's script events, you select your table so that the tabs for the rows and columns appear. Then, you select the one next to your group header and then click on the script tab. Again, the drop down will be at the top of the page to allow you to go to the onCreate method.<br />
<br />
Hope this helps!<br /></p></blockquote>
<br />
<br />
Thanks for your detailed email.<br />
It works, only the number shows up as 1.0,2.0 etc.<br />
Is there anyway I can get Integers?<br />
Also, Is there a way that I can display only the first 10 rows in the report?
mwilliams
Put groupCount.toFixed(0); in your dynamic text box instead of just groupCount;.
The first 10 groups or the first 10 detail row?
kapadiatap
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85450" data-time="1321567066" data-date="17 November 2011 - 02:57 PM"><p>
Put groupCount.toFixed(0); in your dynamic text box instead of just groupCount;.<br />
<br />
The first 10 groups or the first 10 detail row?<br /></p></blockquote>
<br />
I tried that, but when I update it, the value does not show up in the output.<br />
Thanks for your response again.<br />
<br />
First 10 group elements:<br />
<br />
Example:<br />
Position AccountNum Balance Credit Debit<br />
<br />
1 12265452 Operating 1,194,965.17 1385438.32 1 1206784.38 2 <br />
<br />
2 12365456 Operating 636,728.84 1118741.44 1 1569302.01 3 <br />
<br />
3 12365457 Operating 511,754.52 0.00 0 511754.52 1 <br />
<br />
4 12365455 Operating 321,243.49 0.00 0 321243.49 1 <br />
.<br />
.<br />
.<br />
10 --> Should be the last one.
mwilliams
Your count doesn't show up when you use .toFixed(0)? Can you recreate your issue with the sample database and attach it, cause it works for me.
kapadiatap
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85486" data-time="1321647704" data-date="18 November 2011 - 01:21 PM"><p>
Your count doesn't show up when you use .toFixed(0)? Can you recreate your issue with the sample database and attach it, cause it works for me.<br /></p></blockquote>
<br />
<br />
I managed to fix this issue by created a new Data element with Type Integer instead of using the dynamic value.<br />
<br />
How can I display only the first 10 rows from the top level group?....<br />
I tried using the groupcount variable we created (above) in the table-filter and the group-filter, but it does not work.
mwilliams
Since you created a binding on your table for the "group count", did you filter based on this new binding or on the actual variable?