Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 159857

Summary: [Improve Page Aggregate capabilities] Add support for page aggregates / page totals
Product: z_Archived Reporter: Mario Winterer <mario.winterer>
Component: BIRTAssignee: Wei Yan <wyan>
Status: VERIFIED FIXED QA Contact: mindan xu <mindan.xu>
Severity: enhancement    
Priority: P2 CC: bluesoldier, chrishane, qwang, wenfeng.fwd, wlin, wyan, xwang, xxue, yli, zfei, zhlu
Version: 2.2.0Keywords: plan
Target Milestone: 2.5.0 RC1   
Hardware: All   
OS: All   
Whiteboard: Autoed,G
Attachments:
Description Flags
sample to display the first and last element in the page header
none
sample to use seperate page number in each group none

Description Mario Winterer CLA 2006-10-05 06:46:27 EDT
At the moment, it is not possible to print page totals (or any other page-related aggregates) in the page header or footer.

I know that this is hardly possible because neither html nor pdf via FOP can tell anything about the page size or the print margins.

But I think, page aggregates are very essential for the success of BIRT. Without this feature, a lot of projects will be forced to use other reporting engines. My current project is one of those and in many european countries page totals in reports are required for almost all financial applications.

What I'm dreaming of:
+ page totals (e.g. number of employees on this page, and sum of their salary)
+ accumulated (group) aggregates / continous summation (e.g. number of employees so far, and sum of their salaries)
Comment 1 Wei Yan CLA 2006-12-25 22:36:40 EST
can we add three events in the master page:
1. onPageStart
    The user can initialize the page aggregation variables.
    After this event, the engine will create the page header.
2. onPageContent
    For each content displayed in the page, the event will be triggered. In the event, the user need get the value from content and sum them together.
    After this event, the engine will output the content into the page body.
3. onPageEnd
    The user can finalize the page aggregation.
    After this event, the engine creates the page footer.
Comment 2 Chris Hane CLA 2006-12-26 11:47:50 EST
Excuse me if I'm mis-reading your comment.  It looks like you want to have page functions be some type of scriptable variables.  If that is the way you implement it, that is fine - all I really want is access.

However, I like how jasper reports has implemented similar functionality and created a "band" where any of the existing reporting functionality can be added (e.g., built in functions).  It would be nice to be able to use the GUI to add a row to a table similar to grouping so that the GUI builder could be used and page totals/functions/labels/formating could be seen visually.

However, that might be a longer term wish list item.
Comment 3 Wenfeng Li CLA 2006-12-26 13:59:33 EST
(In reply to comment #2)
> Excuse me if I'm mis-reading your comment.  It looks like you want to have page
> functions be some type of scriptable variables.  If that is the way you
> implement it, that is fine - all I really want is access.
> However, I like how jasper reports has implemented similar functionality and
> created a "band" where any of the existing reporting functionality can be added
> (e.g., built in functions).  It would be nice to be able to use the GUI to add
> a row to a table similar to grouping so that the GUI builder could be used and
> page totals/functions/labels/formating could be seen visually.
> However, that might be a longer term wish list item.

Please check out the master page header/footer feature in BIRT.  You can put most of the report items and autoText there with visual labels, grids, and formatting.  

The enhancements seems to be adding access to the data in the page in the page header and footer. 
Comment 4 Wenfeng Li CLA 2006-12-26 14:17:59 EST
> What I'm dreaming of:
> + page totals (e.g. number of employees on this page, and sum of their salary)
> + accumulated (group) aggregates / continous summation (e.g. number of
> employees so far, and sum of their salaries)

The main issue we need to address is how to specify above totals in the master page header and footer.  Since some of the report pages might not have employee on it, for example if it is a master detail report where the first few pages are department/division numbers and follow by many pages of employee number.

How about adding a "pageTotals" function group (or scribtable object using implmentation terminologu) for data report items in the master page and footer?  The syntax could be pageTotoal.count(table["ABCtable"].row["employee"].  or pageTotal.sum(table["ABCtable"].row["salary"]).  If ABCTable doesn't appear in this page, it will be evaulated to 0.

For the accumulated totals, we can add another function groups as "pageRunningTotals", similar syntax, except the calculation will be accumulated  totals upto the current page.

please let us know if such solution would be sufficiently easy to use.
Comment 5 Wei Yan CLA 2009-04-27 23:29:47 EDT
defer to RC1 due to resource limitation.
Comment 6 Wei Yan CLA 2009-05-15 03:34:35 EDT
Fixed.

Create a new page scripting framework which support user added page aggreations:
1. define page variables/report variables in the report, the report variable is saved only once while the page varabile are saved for each page.
2. define onPageStart/onPageEnd in the report and master pages.
3. define onPageBreak in the report element.
4. support the auto-text to access the page varaible and report varaible. 
5. add the API to access the page varaile through the page scripts.
Comment 7 Wei Yan CLA 2009-05-15 03:35:59 EDT
Created attachment 135927 [details]
sample to display the first and last element in the page header
Comment 8 Wei Yan CLA 2009-05-15 03:36:44 EDT
Created attachment 135928 [details]
sample to use seperate page number in each group
Comment 9 Wei Yan CLA 2009-05-15 03:38:55 EDT
*** Bug 165399 has been marked as a duplicate of this bug. ***
Comment 10 Wei Yan CLA 2009-05-15 03:41:29 EDT
*** Bug 197185 has been marked as a duplicate of this bug. ***
Comment 11 Wei Yan CLA 2009-05-15 03:42:58 EDT
*** Bug 212837 has been marked as a duplicate of this bug. ***
Comment 12 Wei Yan CLA 2009-05-15 03:46:01 EDT
*** Bug 213969 has been marked as a duplicate of this bug. ***
Comment 13 mindan xu CLA 2009-05-17 23:03:26 EDT
Mark as verified first, some bugs occur in the testing progress and i'v opened new entries.
Build <2.5.0.v20090518-0630>