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

Calculating different summaries with RB7

edited October 2005 in General
Hi there!

I have a report like this:

Code Value
---------------------
A 100.00
B 200.00
A 150.00
C 200.00
D 100.00
and so on

There can be only a few different codes. Now I would like to have a
summarie like this:

Summerie:
------------------------
Total: 750.00
A 250.00
B 200.00
C 200.00
D 100.00

What is the best way to calc this sub-Summaries? They are not sorted.
When I make this via RAP I have the problem that a record is sometimes
calculated twice (on pagebrake). How can this be done?
Thank you.

Gruß aus den Bergen
Günter

Comments

  • edited October 2005
    Hi Gunter,

    Try placing an invisible TppVariable in the detail band and in its OnCalc
    event update three variables in the summary band. For instance...

    procedure Variable1Calc(Sender: TObject; var Value: Variant);
    var
    lsCode: String;
    ldValue: Double;
    begin

    lsCode := Report.DataPipeline['Code'];
    ldValue := Report.DataPipeline['Value'];

    if lsCode = 'A' then
    Variable2.Value := Variable2.Value + ldValue;

    if lsCode = 'B' then
    Variable3.Value := Variable3.Value + ldValue ;

    //And so on....
    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.