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

Detail Sum

edited February 2002 in General
Hallo ..I've this problem:

I've a variable Sum that I set in the ppDetailBand1BeforeGenerate event
and I give it's value in the ppGroupFooterBand1BeforeGenerate ..
If I "scroll" the pages from first to last then the value of ppLabel is
right as
asum of all detail band of the group but if I "scroll" the pages from last
to first
the value of pplabel1 is wrong...How can I solve?

P.S.Excuse me for my bad english.


procedure TForm1.ppDetailBand1BeforeGenerate(Sender: TObject);
begin
Sum:=Sum+ppBDEPipeline1.GetFieldasDouble('Value');
end;

procedure TForm1.ppGroupFooterBand1BeforeGenerate(Sender: TObject);
begin
ppLabel1.caption:=formatfloat(disFmt, Sum);
Sum:=0;
end;

Comments

  • edited February 2002
    Use a TppVariable and its OnCalc event handler for calculations. The
    BeforeGenerate and BeforePrint events of bands will fire more than once,
    more likely when KeepTogether action happens as a band generates and breaks
    over two pages. The OnCalc event of a TppVariable is controllable through
    the timing dialog, and defaults to calculate on the record Traversal. This
    means that the calculation will only fire once for every record in the
    dataset.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.