Question: "I am using a Variable in the Group Footer to conditionally calculate totals for each group. I want to add a second Variable to the Summary that accumulates the results calculated for each group."
Answer: The following example uses two Variable components: vCustomerTotal and vCustomerSummary. The variable vCustomerTotal has its Timing defined to Reset on GroupEnd.
There are two options for accumulating the summary total.
Example:
procedure vCustomerTotalOnCalc(Sender: TObject; var Value: Variant);
begin
if (plCustomer['Amountpaid'] > 100.00) then
begin
{sum detail}
Value := Value + plCustomer['Amountpaid'];
{accumulate summary}
vCustomerSummary.Value := vCustomerSummary.Value + plCustomer['Amountpaid'];
end;
end; Example:
procedure vCustomerTotalOnCalc(Sender: TObject; var Value: Variant);
begin
{sum detail}
if plCustomer['Amountpaid'] > 100.00 then
Value := Value + plCustomer['Amountpaid'];
end;
procedure vCustomerSummaryOnCalc(Sender: TObject; var Value: Variant);
begin
{accumulate summary}
Value := Value + vCustomerTotal.Value;
end;