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

Bug 202438

Summary: [Improve Page Break Management] Create a total page number per group
Product: z_Archived Reporter: Lourens van Nieuwenhuizen <lvnieuwenhuizen>
Component: BIRTAssignee: Wei Yan <wyan>
Status: VERIFIED FIXED QA Contact: mindan xu <mindan.xu>
Severity: enhancement    
Priority: P3 CC: bluesoldier, mehmetfd, pinny, wenfeng.fwd, whe, wyan, xxue, yanke
Version: 2.2.0Keywords: plan
Target Milestone: 2.5.0 RC1   
Hardware: All   
OS: All   
Whiteboard: Autoed,G
Attachments:
Description Flags
pv-group-total-page
none
screenshot
none
generated pdf file
none
new report design
none
Test for page variable page number not on first page none

Description Lourens van Nieuwenhuizen CLA 2007-09-06 09:15:48 EDT
Hi

We want to create a report with a "sub report", the sub report will be repeated per a grouping in the main report and can span over 2 pages.

These sub reports needs to show their own pageNumber numbering and reset it per group. The total pages per group will be variable.

Example:

Main report

 Contract A
     Data
   page 1 of 4
     Data
   page 2 of 4
     Data
   page 3 of 4
     Data
   page 4 of 4

 Contract B
     Data
   page 1 of 2
     Data
   page 2 of 2

Please contact me if you don't understand.

Lourens
Comment 1 Mehmet Fehmi CLA 2007-11-16 00:31:42 EST
(In reply to comment #0)
> Hi
> We want to create a report with a "sub report", the sub report will be repeated
> per a grouping in the main report and can span over 2 pages.
> These sub reports needs to show their own pageNumber numbering and reset it per
> group. The total pages per group will be variable.
> Example:
> Main report
>  Contract A
>      Data
>    page 1 of 4
>      Data
>    page 2 of 4
>      Data
>    page 3 of 4
>      Data
>    page 4 of 4
>  Contract B
>      Data
>    page 1 of 2
>      Data
>    page 2 of 2
> Please contact me if you don't understand.
> Lourens


I have this same problem for a group report without subreport. Is there a way of showing the page numbers for a group report as described above?
Comment 2 Federico CLA 2007-12-07 08:00:14 EST
We are also very interested in this functionality.

Let we know if we can partecipate in its definition/implementation.
thanks,

Federico
Comment 3 Wei Yan CLA 2008-05-28 22:30:56 EDT
defer to next major milestone. We need resolve most of the page-break/page-number/page-script issues together.
Comment 4 Pinny Markowitz CLA 2009-03-31 11:10:46 EDT
This is something required by several of our reports as well - will this enhancement likely be included by the target milestone?
Comment 5 Peter Yap CLA 2009-04-08 02:32:58 EDT
i need this feature too. hope it can include in 2.5.0 M7 release.
Comment 6 Wei Yan CLA 2009-04-27 23:30:03 EDT
defer to RC1 due to resource limitation.
Comment 7 Wei Yan CLA 2009-05-15 04:49:16 EDT
Created attachment 135948 [details]
pv-group-total-page

an example to demonstrate the group page number, group total page number through page aggregation.
Comment 8 Wei Yan CLA 2009-05-15 04:52:11 EDT
resolve through the new page scripting framework. see the attached example.
Comment 9 Wei Yan CLA 2009-05-15 04:52:29 EDT
fixed.
Comment 10 mindan xu CLA 2009-05-22 06:09:03 EDT
Group name and group total page not work in web viewer. And group name is not consistant with the group detail in table content. see the screenshot

Build <2.5.0.v20090522-0630>
Comment 11 mindan xu CLA 2009-05-22 06:11:05 EDT
Created attachment 136790 [details]
screenshot
Comment 12 mindan xu CLA 2009-05-22 06:12:45 EDT
Created attachment 136794 [details]
generated pdf file
Comment 13 Wei Yan CLA 2009-05-25 03:21:19 EDT
Created attachment 136963 [details]
new report design
Comment 14 Wei Yan CLA 2009-05-25 03:22:20 EDT
the syntax to define the page aggregation has been changed, use the latest report design for testing.

the attribute of page aggregation "workMode" is changed to "type".
Comment 15 mindan xu CLA 2009-05-25 06:25:32 EDT
Verified.
Comment 16 Lourens van Nieuwenhuizen CLA 2009-06-03 06:52:27 EDT
Hi

I found that the page variable does not display on the first page of the document. I've even made the value 1 in onPageStart.

Lourens
Comment 17 Wei Yan CLA 2009-06-03 23:05:28 EDT
can you attache a sample report design?
Comment 18 Lourens van Nieuwenhuizen CLA 2009-06-04 03:04:27 EDT
Created attachment 138253 [details]
Test for page variable page number not on first page

Hi

Here is the example for the page number not showing on page 1 and 2.

Also note that there are 2 page breaks but the page number does not increment and displays 2 on the next status' first page which is on page 3 of the whole document, which means it did not register that there were 2 page breaks in between. But also points to the change made to set the page number to 1 and group name to first status onPageStart, causes the onPageEnd logic to fail.

Also note that the total page number is also incorrect. It's displays  1 of 1 then 2 of 2, rather than 1 of 2 and 2 of 2.

Other examples:

The resolved status data are over 2 pages but show 1 of 1 on both pages

Lourens
Comment 19 Wei Yan CLA 2009-06-17 22:52:24 EDT
There are bugs in your scripts. Take the first page as example:

onPageStart

//the prevGroupKey and groupPageNumber are all NULL for first page.
var prevGroupKey = reportContext.getPageVariable("GROUP_NAME");
var groupPageNumber = reportContext.getPageVariable("GROUP_PAGE");
if (groupPageNumber == null)
{
   groupPageNumber = 1;
}
    
if (prevGroupKey == null)
{
  reportContext.setPageVariable("GROUP_NAME", groupKey);
}
reportContext.setPageVariable("GROUP_PAGE", groupPageNumber);

//After evaluation, the prevGroupKey is the first group while the group page number is 1.


onPageEnd:

//the prevGroupKey is the the current group
//the groupPageNumber is 1
var prevGroupKey = reportContext.getPageVariable("GROUP_NAME");
var groupPageNumber = reportContext.getPageVariable("GROUP_PAGE");

//as the prevGroupKey is the group key, so the groupPageNumber is set to 2.
if (prevGroupKey == groupKey)
{
    if (groupPageNumber != null)
    {
        groupPageNumber = groupPageNumber.intValue() + 1;
    }
    else {
    	groupPageNumber = 1;
    }
}
else {
   	groupPageNumber = 1;
}

//after evaluate, the groupPageNumber is 2. It is incorrect.

Comment 20 Lourens van Nieuwenhuizen CLA 2009-06-22 07:03:43 EDT
This is the same script in the previous design attached here 25-05-2009.

Look at the attached - generated pdf file aswell to see that nothing happens on the first group pages and that it DONOT show  1 of 2 and 2 of 2 etc but 1 of 1 and 2 of 2.