Re: Calculate a subreports totals
Greetings,
I have three subreports on a detail band of the main report which runs once.
I have ppVariables setup to do currency totals one on each subreport. I
would like to total all three subreports totals into a grand total in
summary of the report. This is what I have:
header
detail
SBR1
vDoorTotal - Cal:Transveral Reset:ReportEnd
SBR2
vMachCostTotal - Cal:Transveral Reset:ReportEnd
SBR3
vAddCost - Cal:Transveral Reset:ReportEnd
footer
SUMMARY
vGrandTotal Cal:ReportEnd Reset:ReportEnd
You would think that I would be able to access those variables just about
anywhere in the report. When it gets to the calc of the vGrandTotal, all the
other variables are 0's.
procedure TfrmHMDoorSummary.vGrandTotalCalc(Sender: TObject;
var Value: Variant);
begin
ShowMessage(vDoorTotal.AsString);
vGrandTotal.Value := vGrandTotal.Value + (vDoorTotal.Value+
vMachCostTotal.Value+vAddCostTotal.Value);
end;
Anyone see what I am doing wrong.
TA
I have three subreports on a detail band of the main report which runs once.
I have ppVariables setup to do currency totals one on each subreport. I
would like to total all three subreports totals into a grand total in
summary of the report. This is what I have:
header
detail
SBR1
vDoorTotal - Cal:Transveral Reset:ReportEnd
SBR2
vMachCostTotal - Cal:Transveral Reset:ReportEnd
SBR3
vAddCost - Cal:Transveral Reset:ReportEnd
footer
SUMMARY
vGrandTotal Cal:ReportEnd Reset:ReportEnd
You would think that I would be able to access those variables just about
anywhere in the report. When it gets to the calc of the vGrandTotal, all the
other variables are 0's.
procedure TfrmHMDoorSummary.vGrandTotalCalc(Sender: TObject;
var Value: Variant);
begin
ShowMessage(vDoorTotal.AsString);
vGrandTotal.Value := vGrandTotal.Value + (vDoorTotal.Value+
vMachCostTotal.Value+vAddCostTotal.Value);
end;
Anyone see what I am doing wrong.
TA
This discussion has been closed.
Comments
Try placing TppVariables inside the detail band of each subreport, then in
the OnCalc event of each of them, update the value of the variable located
in the main report. This is the standard way to keep track of the
subreport totals inside the main report. See the example below.
http://www.digital-metaphors.com/tips/TotalsFromSubReport.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com