Delphi:
Update the main report variables directly inside the OnCalc event of a variable inside your subreport.
RAP:
Download: TotalsFromSubReport.zip
TotalsFromSubReportWithRAP.zip
RunningPageTotalFromSubreport.zip
Sample Delphi code:
procedure TForm1.ppVariable2Calc(Sender: TObject; var Value: Variant); begin //ppVariable1 is located inside the main report. ppVariable1.Value := ppVariable1.Value + ppSubReport1.Report.DataPipeline['AmountPaid']; end;
Sample RAP Code:
Global Declarations...
var varMainPageTotal: TppVariable;
Global Events...
procedure GlobalOnCreate; begin //Variable1 is on the main report. varMainPageTotal := Variable1; end;
Subreport...
procedure SummaryAfterGenerate; begin //This will update Variable1.Value. varMainPageTotal.Value := varMainPageTotal.Value + DBCalc1.Value; end;