Emit page footer only when group is split across pages


 When emitting a group, I have a specific field sum (updated with each detail line of the group) that is displayed in the Group Footer - e.g.

    (in Group Header)
    Company: APPLE   
    (in Detail - the rightmost column is a running sum - reset per group)
    1/1/2011        100 Units sold      144.000$
    1/2/2011        34  Units sold      170.000$  
    (in Group Footer)
    Total of APPLE so far:              170.000$
    Company: Microsoft   
    1/1/2011        10 Units sold        24.000$
    1/2/2011        14 Units sold        32.000$  
    Total of Microsoft so far:           32.000$
    Company: Google
etc. This works fine.
The additionaly requirement that I have, is that the Group Footer must also be printed in the Page Footer - but only when it so happens that the Group is split across pages - in fact, if a group doesn't fit on a page, this is expected:
    Old page, bottom:
    Company: Microsoft   
    1/1/2011        10 Units sold        24.000$
    1/2/2011        14 Units sold        32.000$  (
    (In Page Footer:)
    Total of Microsoft so far:           32.000$
    New page, top:
    Total of Microsoft so far:           32.000$
    1/3/2011         5 Units sold        37.000$
    1/4/2011        14 Units sold        32.000$  
That is, the total of the group that is split due to the page break, is printed once in the page footer (just as it would with the ending Group footer), and on the new page, it is also printed in the Page Header - i.e. the page starts by showing what was the total of the last (split across the page break) group.
Note that this must NOT happen blindly in every page - because if a group happens to end on a page break, you would then see TWO "Total of..." lines - one from the Group footer, and one from the Page footer.
Can this be done with Jasper reports? Is there a "printWhen" expression I can use to mark that an element in the Page Footer must only be printed when the last printed group is not done yet? Similarly for the Page Header?
ttsiodras's picture
Joined: Dec 12 2012 - 11:15pm
Last seen: 7 years 10 months ago

0 Answers:

No answers yet