Referencing DBCalc value in ppVariable in Group Footer
I'm trying to calculate a weighted percentage based on two detail columns in
my report (Commission/Premium). In my group footer, I have ppDBCalc
components for Commission and Premium, and a ppVariable for which I have the
following OnCalc code:
{ Default the value to 0 }
Value := 0;
{ If the group's total premium isn't zero, calculate it }
if not (ppDBCalcPremiumTotal.Value = 0) then
begin
Value := 100 * (ppDBCalcPremium1.Value
/ ppDBCalcGrossComm1.Value);
end;
I've tried numerous combinations for the CalcType and CalcComponent
properties of the variable, but always get zero for my result. Exactly when
are the values in my ppDBCalc fields available for my calculation? I'm
starting to think that I can't depend on them to be available for any longer
than the instant in which they're printed. Do I need to create extra
variables and keep track of the sum within each group myself?
Thanks.
my report (Commission/Premium). In my group footer, I have ppDBCalc
components for Commission and Premium, and a ppVariable for which I have the
following OnCalc code:
{ Default the value to 0 }
Value := 0;
{ If the group's total premium isn't zero, calculate it }
if not (ppDBCalcPremiumTotal.Value = 0) then
begin
Value := 100 * (ppDBCalcPremium1.Value
/ ppDBCalcGrossComm1.Value);
end;
I've tried numerous combinations for the CalcType and CalcComponent
properties of the variable, but always get zero for my result. Exactly when
are the values in my ppDBCalc fields available for my calculation? I'm
starting to think that I can't depend on them to be available for any longer
than the instant in which they're printed. Do I need to create extra
variables and keep track of the sum within each group myself?
Thanks.
This discussion has been closed.
Comments
To force a dbCalc to generate before the group footer variables generate:
1. Call SendToBack on the dbCalc and you can leave the dbCalc in the group
footer band
or
2. Place the dbCalc in the detail band and set its visibility to false.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com