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

Tppvariable

edited February 2008 in General
Hello

i have 3 sums in a group footer where i want those 3 values as total in a
Tppvariable . So i wrote a oncalc handler and summed these 3 values.
The first time i see the report the value is not correct, but after showing
it the second time the value is correct.

What i'm a doing wrong

The report passseting is twopass.

Regards Frank

Comments

  • edited February 2008
    Hi Frank,

    Rather than calculate the value of the three sums, try calculating the sum
    directly in the OnCalc of the TppVariable. If the timing is set to
    Traversal (which is the default setting), the OnCalc event will fire for
    each record. Something like the following...

    begin
    Value := Value + Report.Datapipeline['MyField1'] +
    Report.Datapipeline['MyField2'] + ... etc.
    end;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2008
    Hello Nico

    that seems to work great except that 1 have one field that has to be
    subtracted once.

    So
    Field 2
    Field 2
    Field 2

    totaal 6
    Cost -6
    sum 0

    In your case the cost field is also 3 times in the value so i get a value of
    6 -18=-12
    how can i do that ?

    Frank



  • edited February 2008
    Hi Frank,

    In this case, you could possibly keep track of the field that needs to be
    subtracted separately from the others using a separate variable or a class
    field. Or you could place a condition in the OnCalc to only use the
    subtracted field once.

    --
    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.