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

DBCalc SUM only on none repeated values

Hi,

I've a some columns in the Detail band that had the "SuppressRepeatedValues" set to true, but would like my DBCalc SUM to ignore the Repeated values also.

Is there a way to achieve this?

Regards,
Mario

Comments

  • Hi Mario,

    The DBCalc component has a SuppressRepeatedValues property. Use this to get the effect you are after.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Nico,

    Thank you for your answer, unfortunately it doesn't work as I expect. Let me explain it better:

    Let say the detail band has the following values:

    Date Country QTY
    -----------------------------------
    Jan-21 Mexico 100
    Feb-21 Mexico 100
    Mar-21 Mexico 100
    Jan-21 USA 100
    ----------------------------------
    TOTAL 400

    I need to suppress the repeated values on the QTY column and the TOTAL SUM to consider only the shown values. Like this:

    Date Country QTY
    -----------------------------------
    Jan-21 Mexico 100
    Feb-21 Mexico
    Mar-21 Mexico
    Jan-21 USA 100
    ----------------------------------
    TOTAL 200

    If I set the "SuppressRepeatedValues" to TRUE on the QTY column and the TOTAL DBCalc I get the following result:

    Date Country QTY
    -----------------------------------
    Jan-21 Mexico 100
    Feb-21 Mexico
    Mar-21 Mexico
    Jan-21 USA 100
    ----------------------------------
    TOTAL 400

    As you can see, the DBCalc is still counting the Suppressed values.

    Is there any workaround for this?

    I'm currently on RB 21.02.


    Regards,
    Mario
  • Thanks for the clarification.

    In this case you will need to make the sum calculation manually using a TppVariable and the OnCalc event. Something like the following:

    procedure TForm2.ppVariable1Calc(Sender: TObject; var Value: Variant);
    var
    lCurrentValue: Integer;
    begin

    lCurrentValue := ppChildReport1.DataPipeline['QTY'];

    if lCurrentValue <> FPreviousValue then
    Value := Value + lCurrentValue;

    FPreviousValue := lCurrentValue;

    end;
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.