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

Variable Sum Question

edited May 2003 in General
Hello,

I have a ppVariable (a Double) in the detail section. I would like to
present the sum for this variable in a group footer. What is the
recommended way to accomplish this?

Thank you,
Mike Malinowski

Comments

  • edited May 2003
    Mike,

    Create a variable in the group footer and update the value of that variable
    in the OnCalc event of the variable in hte detail section. Something like
    this...

    procedure Variable1Calc(Sender: TObject; Value: Variant);
    begin
    TotalVariable.Value := TotalVariable.Value + Value;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2003
    Thank you. This appears to work when using a detail variable's onCalc event
    to determine the value of a ppvariable in a group footer.

    However, when I try to use the onCalc event of a variable in a group footer
    to determine the value of a variable in the next higher group footer, I end
    up with incorrect values. I'm basically summing values in each group
    footer, progressing to the next higher group.

    I set the detail variable's oncalc timing to traversal and reset on
    traversal. How should I be setting the timing in the first group's
    variable? GroupStart, GroupEnd, Traversal?

    Thank you again,
    Mike Malinowski

  • edited May 2003
    Mike,

    You are going to want to make duplicate calculations for each variable in
    different groups inside the OnCalc event of the Detail variable. Then you
    need to set the reset for each of the group variables to GroupEnd. This
    way, the variables will be receiving the same information but resetting at
    different times during report generation.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.