Home RAP

summary calculation

edited November 2003 in RAP
Hi all,

I've create a report representing a master detail relationship.
Main report contains a sub report in the detail band. The sub report has
some components in a keep together region.

I want to calculate summary of the detail records of the sub report and
show this summary in the footer section of the main report.

What I've done so far:

Added a Variable to the footer, create a global variable (varTotal) and
set a reference to it in the OnCreate event of the master report.

Then I've inserted a variable to the detail band of the sub report and
implemented OnCalc procedure:

Value := Value + Articles['Price'];
varTotal.Value := value;

For testing purposes I've setting visibility of the variable to true, so
I can see it always showing the right summary value.

The problem is, the variable in the footer of the main report does not
show the correct value.
If the last record doesn't fit on the page the value of this record is
still added to the summary value of my global variable.

Is caching of variables limited to variables in the actual band or in
the actual (sub) report? Am I missing something basic or is there an
easy solution?

As a workaround I'm using the AfterPrint event of the detail band in
the sub report to assign the value of the variable to the global one:

varTotal.Value := varDetail.Value;

This works fine so far but I'm not sure if this is a good practice.

Any idea or recommendation?

Regards, Uwe

Comments

  • edited November 2003
    Hi Uwe,

    Unfortunately, you have run accross a limitation of ReportBuilder. Using
    the DetailBand.AfterPrint event in this case is the best option for what you
    need to do.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.