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!

Help with Summary Count

Status
Not open for further replies.

thepeej

Technical User
May 22, 2002
1
EU
I am trying to create a summary field in the group footer of my report, but am having a few problems.
The field I am trying to summarise on is named 'Activity' and contains one of three strings:

'Processed Cheque'
'Reprocessed Cheque'
'Spoiled Processed Cheque'

I need to produce two summary counts on this - one for total no of Processed cheques and one for total spoiled cheques.
As such I need a count of specific instances in a field.

ie: a count of all instances of 'Processed Cheque' in the following example would produce a result of 3

Activity
Processed Cheque
Processed Cheque
Spoiled Cheque
Reprocessed Cheque
Processed Cheque

I have tried various methods but have been unable to find a solution. Can someone help?

Thank you
 
As is often the case with Crystal, there are a couple of ways you can do this. Use conditional running totals, or use variables to count the instances and pass the results into the report.

The former is quite simple, but I'll show you the latter - being as that's how I learned what was going on when I was in your shoes. ;)

Formula1:
whileprintingrecords;
numbervar processed;
numbervar reprocessed;
numbervar spoiled;

if {cheque} = 'processed' then processed := processed + 1
else
if {cheque} = 'reprocessed' then reprocessed := reprocessed + 1
else
if {cheque} = 'spoiled' then spoiled := spoiled + 1

Where you want the totals displayed:
Formula2:
whileprintingrecords;
numbervar processed;

...and the same for the other 2.

If you're grouping these counts, and need to start a new count with each new group, make a reset formula:

whileprintingrecords;
numbervar processed := 0;
numbervar reprocessed := 0;
numbervar spoiled := 0;

...and place it as the last field in the group footer. Make sure this field is suppressed too.

And that's about all you have to do. In the future, you may want to try doing this with the running total function (right click on your field and select running total from the pop up.)

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top