Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Retrieve Group Counts

Status
Not open for further replies.

4hrlife

Technical User
Feb 23, 2007
7
US
Hi, I am using Crystal Reports 8.5 Version. I am trying to get a count of items that only appears within a group. Example below, I have a category named 'Ice Cream' and I have several different flavors...I want to count the number of flavored ice cream within each group. In this case I have 3 different flavors displayed of many:

Group Header 1 = Ice Cream
Group Header 2 = Flavors

Ice Cream
Chocolate
Vanilla
Strawberry
Total = 3 Flavors

I want to count the number of flavors that is displayed in group header #2. How is this done?
 
Insert a distinctcount (right click on {table.flavor} in the detail section->insert summmary) on the flavor field at the Group #1 level.

-LB
 
Okay, when I do that it includes the suppressed items also...this is what I am trying to prevent. I want to count the data that is displayed only.

 
You need to reveal all in your initial post. This is the first you have mentioned any suppressed items.

You can insert a running total that does a distinctcount of flavor, evaluates using a formula that is the opposite of your suppression criteria, and resets on change of group#1. Place the running total in the GF#1.

You could also instead try to eliminate the unwanted records in your record selection formula.

-LB

 
I do apologize for not giving all details to my report setup. Okay here is what I have:


#1 - Formula:

if ({Table.IceCream Flavor} = ["Chocolate", "Vanilla","Strawberry","Banana"]) then
1
else
0

I have grouped the {Table.IceCream Brand} and grouped the
{Table.IceCream Flavor}

I've got the detail section suppressed so all you see is

BlueBell
Vanilla
Strawberry
Chocolate

Carvel
Banana
Strawberry

Instead of this:

BlueBell
Vanilla
Vanilla
Strawberry
Strawberry
Chocolate
Chocolate

Within Group #2 I want to count the total number of flavors that is displayed only within the group minus the suppressed items.

It will not be feasible to eliminate the unwanted records in my record selection formula because I want to use other brands and flavors at a later date.

I hope this is enough info and I hope you can understand what I am asking...thanks again for your patience and your help.

 
"Within Group #2 I want to count the total number of flavors that is displayed only within the group minus the suppressed items"
Your "suppressed items" are repeated detail sections.
Again, use 'distinctcount' function on Group 2 for your flavors.
And create Group 3 for these flavors -- you won't need to suppress details, just display Group 3.

sailor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top