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

Sum on variable

edited October 2010 in General
?Hi, How do we get a sum of a variable on Report Builder.

For a database field, we use the DBCalc but what if there is a variable.

Thanks.



--- posted by geoForum on http://www.newswhat.com

Comments

  • edited October 2010
    Hi Ashwin,

    Do this by updating the value of another variable inside the original
    variable's OnCalc event. Say for instance you have a variable (Var1) in the
    detail band and would like to calculate its sum in the summary band (Var2).

    procedure TForm1.Var1Calc(Sender: TObject; var Value: Variant);
    begin
    //Make the original calculation
    Value := //some calculation

    //Update the summary variable value
    Var2.Value := Var2.Value + Value;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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