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)
Page Totals (displayed on the following page)
oshbb
Hi!<br />
<br />
I'm facing some problems displaying page totals on a report (which actually is an invoice), where the page total of page n shall be displayed on top of page n+1. I therefore use a table which conditionally displays certain rows.<br />
<br />
This is what I'm doing:<br />
<br />
- store the sum of all invoice positions so far in a global variable 'sum'<br />
- count the positions on the current page in a page variable 'position'<br />
- iterate the dataset using a table, with 2 detail rows (the first detail row is for the sum so far)<br />
- except for the first invoice position on a page (position == 0) the first detail row is invisible (display = 'none')<br />
<br />
This is what happens:<br />
<br />
- from page 2 onwards the <strong class='bbc'>second</strong> invoice position displays the sum so far (should be the first position)<br />
<br />
Any ideas what could be wrong here?<br />
<br />
Thanks a lot in advance.
Find more posts tagged with
Comments
thuston
The issue would be when the variable is populated and when it is accessed. You might to use a HashMap and it in onRender, not onCreate.
Your approach sounds overly complicated. Why do you need to store the aggregation if you are just going to use it at the bottom of the same section? It seems you should be able to just use an Aggregate control against the source DataSet.
oshbb
Thanks for your reply. I will try to use the onRender events. Nevertheless I didn't fully understand your reply concerning the aggregate function. I will try to explain my problem once again:
I have an invoice consisting of a table of items that have a price. The table spans several pages. The first row of the table on page 2 has to display the sum of all prices on page 1. On page 3 the sum of all prices on pages 1 and 2 shall be displayed, and so on.
How could I use an aggregate function for that?
thuston
Can't you use the RunningSum aggregation in your header?
oshbb
RunningSum would be perfect, but it expects some grouping argument for the running sum.
Is it possible to define a group by page (page 1 is a group, page 2 is a group, ...)?
thuston
I think only if you define the page group (ie. Group by rownum in intervals of 30 and have the Group pagebreak).
oshbb
I'm now doing static page breaks in a certain interval and display page totals this way.
Still I'm surprised there's no built-in page-total functionality in Birt as this is quite a common requirement.
Thanks for your input, thuston!