Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

subreport totals problem

edited October 2006 in RAP
Hi,
I have a report which has two subreports in it. The general construction
is this:

PERSON (main report) contains the DAYS(subreport) and that subreport
contains the ACTIVITIES(subreport).

I am trying to get the total from the ACTIVITIES subreport and put it on
the main report in the PERSON group footer. The report is grouped on Person
and the first subreport is grouped on DAY. One person has one or more DAYS
and a DAY has one or more activities for which I add up the calories burned
in the subreport

I declared a global tppVariable and add to it when I have the sum in the
ACTIVITIES subreport using the OnCalc event for the variable in the
ACTIVITIES subreport.
IE: GlblNetCalories := GlblNetCalories + value;

After that, I assign the value to the variable in the Person's group
footer using the OnCalc Event.
IE: Variable38.value := GlblNetCalories;

What happens is that the first page's output for the Variable38 is 0.00.
On the next output page of the report, the total for Variable38 appears.
That is one problem.

The other problem is that if I page-next and then page-back, the totals
grow in size. It is as if the OnCalc events are firing even when I page
back, and end up adding the next page's amounts to the global variable, when
it should be adding the previous pages' amounts instead.

What am I doing wrong? (Delphi Pro 7, ReportBuilder Enterprise (RAP) 9.02.

Any suggestions are greatly appreciated..
Thanks.
pl

Comments

  • edited October 2006
    Hi
    Never mind. I solved it. I moved the assignment of the variable to the
    Footer's "OnBeforePrint" event, and then zeroed out the variable in the
    Footer's "OnAfterPrint and now it works ok..

    Sorry to take up your time..
    pl

This discussion has been closed.