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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TotalCount for each group

Status
Not open for further replies.

JCruz063

Programmer
Feb 21, 2003
716
US
Hello all...

Using Crystal Reports 10, I have a report with 3 groups. Every different value of the first group is printed on a different page. How can I set up a variable to display the total number of records matching each value of my first group?

For example, I can create a formula to calculate the total number of records like this:
[tt]
if group1Field = [red]1[/red] then
totalCount := totalCount + 1;[/tt]

Then, I can just create a formula that simply returns totalCount and be done with it. However, there's one major problem with the above approach: I don't want the nice little [red]1[/red] there, because that would give me the total count of just one value of the group, namely 1 (duh!). I want the formula to look more like this:
[tt]
if group1Field = [red]currentGroupValue[/red] then
totalCount := totalCount + 1;[/tt]

Then, in every page, I want to display totalCount. The question is: how can access the current value of the group (that is, the value of the group on which the page is based) so that the formula can work correctly ? If I'm going about it the wrong way, please let me know...

Thanks!

JC

_________________________________________________
To get the best response to a question, read faq222-2244.
 
You don't need to use a variable. Just right click on a recurring field in your detail section and insert a summary(count) at the group level.

-LB
 
Thanks LB!

The totalCount variable is supposed to be counting because not all values of the recurring field should be included in the count. Why not use a selection formula? Because the records that aren't counted by totalCount are counted somewhere else in the report. I figured it out though.

Thanks again!

JC

_________________________________________________
To get the best response to a question, read faq222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top