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

Returning a count for Grouped Items?

edited December 2006 in End User
Hi,
I've got a report where i'm grouping by a field.
The report currently shows a subtotal for each group.
However, is there a way to use a count to count the items it is grouping by?

I've tried using detail.count but that doesn't return what I want. It
returns the items within the grouped item. But what I want is the count of
the grouped items.

Any help or suggestions would be much appreciatied. I tried using group
footer.count and object/variable.count which doesn't work for me

Comments

  • edited December 2006
    Hi Andrew,

    This can be done using a TppVariable. Place a TppVariable inside the group
    footer of your report, open it's Timing dialog (Right click the variable)
    and select that you would like the variable to reset on "GroupEnd". Next
    select the group you would like to use. Be sure the variable is set to
    calculate on "Traversal".

    Finally inside the OnCalc event of the TppVariable, set the Value parameter
    equal to itself plus one. This will incriment the value each time the
    dataset traverses and reset after each group ends.

    procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
    begin
    Value := Value + 1;
    end;

    Note: Be sure the DataType of the TppVariable is set to dtInteger.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi,

    Thanks for the help, but unfortunately its not producing what I want.

    Its performing just like the Detail Count.

    I have a report that has something like

    ->Supplier(Group header 0)

    ---> Order Number(Group header 1)

    ----->Item Detail(Detail)

    ---> Order Sub Total(Group Footer 1)

    -> Supplier Sub Total(Group Footer 0)

    When I put the variable in the the Group 0 footer, it counts only the number

    Of Item Details within the group. But what I want is a count of the group 1

    Eg.

    ->Supplier A(Group header 0)

    ---> Order Number 11(Group header 1)

    -----> Item Detail 1(Detail)

    -----> Item Detail 2(Detail)

    ---> Order Sub Total(Group Footer 1)

    -> Supplier Sub Total(Group Footer 0)




    What I'm trying to achieve: Count = 1

    What the Variable is returning: Count = 2



    ->Supplier B(Group header 0)

    ---> Order Number 12(Group header 1)

    -----> Item Detail 1(Detail)

    -----> Item Detail 2(Detail)

    -----> Item Detail 3(Detail)

    ---> Order Sub Total(Group Footer 1)

    ---> Order Number 13(Group header 1)

    -----> Item Detail 1(Detail)

    -----> Item Detail 2(Detail)

    ---> Order Sub Total(Group Footer 1)

    -> Supplier Sub Total(Group Footer 0)



    What I'm trying to achieve(the count of order numbers per supplier): Count =
    2

    What the Variable is returning (the count of item details per supplier):
    Count = 5



    Any other suggestions I can try?

    thanks



  • edited December 2006
    Hi Andrew,

    Thanks for the clarification. In this case, try setting the Variable to
    calculate on GroupEnd and select the proper group you would like to count.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi,
    I tried that but it still wasn't producing what I wanted.
    However, I now have some code to count everytime the group value changed and
    used that. Thanks for your help.





This discussion has been closed.