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!

Count of formula, New to Crystal 1

Status
Not open for further replies.

petsgalore

Programmer
Feb 3, 2005
4
US
I'm new to Crystal Reports and I'm setting up a report in Version 8.5. I need a count of a field when a particular option is present in the data, i.e., the field has four possible options; 'N', 'H', 'C', or it can be left blank. Basically, I need to count all the 'N'.

I've tried setting up formula #1 (field = "N") that converts the data to 'Yes/No’. That worked correctly. Then I tried to count all the 'Yes' using the formula #2 ‘Count (field, formula #1, “Yes”)’. The error message I keep getting is ‘the summary /running total field could not be created’. I’ve tried variations of formula #1 were data is converted to ‘True/False’, ‘T/F’ or ‘0/1’ and I still get the same result when I run formula #2. I’ve also tried applying the count function directly to the field (Count (field, field, “N”)) and I’ve also tried (Count (field = “N”)) both gave me the same results as above.

I know I’m probably missing something fairly obvious but I can’t seem to see what it is. At the present time, I’m the only one programming in Crystal Reports where I work. Any help would be greatly appreciated!

 
Hi,
After creating the formula so it resolves to 0 or 1,
insert that formula in your details ( you can supress displaying it), right-click on it and use the Insert Summary function to place the count where you want it to be computed.

[profile]
 
Try:

If {table.field} = "N" then 1

Then right click on the formula and insert a summary (SUM, not count). Please note that the condition that you see as an option when looking at functions, e.g., sum(field,conditional field, condition) is only for use in defining date intervals or other date settings.

-LB
 
You could also use a running total:

Right click on your field > Insert > Running Total > Change 'Type of Summary' to 'Count' > For 'Evaluate', click the 'Use a formula' option, and click the [x+2] button > Enter your test condition : {Table.Field} = "N" > set Reset to 'Never' if you want the total for the entire report > click 'OK', then drag the created running total into the report footer. When you run the report, you should get the total number of N's.

-dave
 
Thank you for all the quick responses. I tried lbass's suggestion and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top