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

Master - detail report grouping calculation is wrong

edited August 2005 in General
Hi,

I have a master-detail report where I have a group defined over a custom
field, this field belongs to the master pipeline.
In my group fouter I want to sum over a field from the detail pipeline.
My problem is that he takes the sum - for all master-records in the group -
of only every first detail record.
It seems that the calc. component is not traversing trough the detail
records.

What am I doing wrong?
Is what I want to to (=sum detail records over different master-records in
one group) even possible?

thx in advance

Kristof Cleves

Comments

  • edited August 2005
    Hi Kristof,

    Since you are trying to keep a sum outside the actual subreport, you will
    need to use two TppVariables rather than a DBCalc component. A sum can
    easily be calculated by placing one TppVariable in the DetailBand of your
    subreport and one inside the GroupFooterBand of your main report. Then,
    inside the OnCalc event of the first variable, update the value of the
    second. Be sure to set the second variable to reset on Group End.

    Example...

    procedure ppVariable1Calc(Sender: TObject; value: variant);
    begin
    ppVariable2.Value := ppVariable2 +
    Subreport.Report.DataPipeline['myfield'];
    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.