Home Subreports

order of calculating values?

edited February 2005 in Subreports
Dear all,
I have 2 similar reports, both have 2 subreports. One subreport
looks at invoices the other at credits.

On the summary of the main report I have a ppvariable. I want it to show the
total of all invoices -all credits.

In the detail band of the subreports I have a beforegenerate event of
total:=total+qinvoiveamount.asfloat;

and

total:=total-qcreditamount.asfloat; respectively;

on the oncalc event for the ppvariable I have
value:=total;


In one report all works perfectly. On the other, the ppvariable value is
calculated BEFORE any traversing of the records.

I cannot see what is different in the way I have defined the 2 reports.
Where should I be looking?

many thanks
--
John Evans
Managing Director
Clear Advantage Ltd

www.Clear-Advantage.co.uk

Comments

  • edited February 2005

    Place a TppVariable in the subreport. Use its OnCalc event to increment the
    Variable in the main report:

    procedure varSub.OnCalc(Sender: TObject; Value: Variant);
    begin
    varMain.Value := varMain.Value + plDetail['Amount'];
    end;

    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2005
    Thanks Nard,

    John

This discussion has been closed.