How To…Display Subreport Totals in the Main Report

Question

“How do I display totals calculated inside a subreport in my main report?”

Solution

Delphi:

Update the main report variables directly inside the OnCalc event of a variable inside your subreport.

RAP:

  1. Declare a global TppVariable from the Module view inside the code workspace (RAP).
  2. Set the global variable equal to a TppVariable in the main report.
  3. Update the value of the global variable inside the subreport (similar to Delphi code).  This will in turn update the value of the variable placed in the main report.

Download: TotalsFromSubReport.zip

TotalsFromSubReportWithRAP.zip

RunningPageTotalFromSubreport.zip

Sample Delphi code:

Sample RAP Code:

Global Declarations…

Global Events…

Subreport…