Running Page Totaling


Active Member
Hi List,

I build a report where I need to have running page totals and these totals have to be transported to the heading of the next page.

I use a columnar section with 2 level break footers and I'm only printing these level break footers. I calculate a running total in the Do Section Event. When the page header is printed I load the total in this header with the running total of the columnar section. My problem is that the Running Total has processed a next detail record but is not jet printed, so my page totals are one line ahead and wrong.

Any suggestions,




Legendary Poster
What about to store the last accumulated values in global variables where you accumulate them, substract these values from Totals when you print it in the Header and add these values again to the Totals after the header were printed
do not put the totals directly onto the header but the reduced (by the last accumulated and stored) values.

For example:

RV TotalOnHeader = RV TotalAccumulatedHidden - rpt_LastAccumulatedValue

Could it work for you?

P.S.: hmmmm..., and what about your system configuration? ;-)

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)


Active Member
Thanx Zoltan,

I had something similar in mind but there might be a better way for this problem...


B7331 (Sp7), AS/400, Citrix
(XE on the way).

PS. hit the post it button just to soon !-).....


Active Member
Zoltan, I'm a different person with quite similar problem. My report needs the page total to be at the bottom of the page. However, the total always total up the next record.

I tried your suggestion but then, the last record will be subtracted from the total and thus, the last page total will be incorrect. Any suggestions to this, anyone?


OneWorld XE, Intel Win2000 SP2, SQL 7 SP1


Active Member
Try this (no guarantee it will work!)
In the Do Section, put the Running Total calculation at the very start of the code, before it reads the line value. This means that when the first line is created, there is no running total until it goes back to the start of the do section for the second line (but before its value is read. (I hope this makes sense!)
This will still leave your last total as wrong, but add the same running total calculation into the End Section (or it could be the After Last Object Printed - I never could get them the right way round!), so it will only be called after the last line has been completed.

Let me know how that goes.

Customer: Xe/NT/Oracle (and FCC1.5)
Office: B7331/NT/SQL


Active Member
Thanks Stewart, it sounds like it will work. But I can't try it out now cause my clustering system is down again. In fact it goes down nearly once every 2 weeks!!! Seems like JDE didn't test clustering with its system.

Will give you the feedback of the result as soon as possible. Thanks!

OneWorld XE, Intel WIN2000 SP2, SQL 7.0 SP2