Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Referencing DBCalc value in ppVariable in Group Footer

edited June 2001 in General
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.

Comments

  • edited June 2001
    Check the TppVariable's type.


    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


  • edited June 2001
    That did it (I tried the first solution). Thanks!
This discussion has been closed.