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

Run totals for groups

edited April 2009 in General
Hi,

I need to run group totals in the first pass and then, in the second pass
calculate some values based on the group total. For instance, I have a
report that totalize sells per product grouped by supplier. I want to run
the % of each product for the given supplier.
I don't know if I was clear, if not I can elaborate better my question.

Thanks.
Ricardo

Comments

  • edited April 2009

    www.digital-metaphors.com/rbWiki/Delphi_Code/Calculations/How_To...Use_a_Look_Ahead_Value_in_a_Calculation

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2009
    I've tried this in the RAP of a report and got a access violation

    procedure Label10OnGetText(var Text: String);
    begin

    Text := DBCalc3.GetLookAheadValue(DBCalc3.getLookAheadKey);

    end;

  • edited April 2009

    The rbWiki page has a downloadable RAP example, did you download it and try
    it out?


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2009
    Looking deeply I see that I should have setted the LookAhead property in my
    component, that was not mentioned in the wiki entry.

    I did download the example and tried very quickly and it thrown an
    exception. At that time I didn't give much attention to it but now I see
    what was wrong. As a sugestion I would purpose for you to change these two
    lines

    lsTotal := StringReplace(lsTotal, '$', '', [rfReplaceAll]);
    lsTotal := StringReplace(lsTotal, ',' , '', [rfReplaceAll]);

    for these

    lsTotal := StringReplace(lsTotal, CurrencyString, '', [rfReplaceAll]);
    lsTotal := StringReplace(lsTotal, ThousandSeparator, '', [rfReplaceAll]);

    so foreigners like me can use this example.

    Thank you for your attention.

    Regards
    Ricardo


  • edited April 2009

    Thanks for the feedbacl, I updated the example.


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.