Create a conditional summary using Crystal Reports

i have a dataset with a field called TYPE.   The data contains 3 different types, "A", "B" and "C".
I would like to use Crystal Reports to count how many records are of type "A", how many of type "B" and how many of type "C".   The field is a string so simply TYPE = "C" will tell me if it is type "C".
Crystal Reports has a Set of Summary functions available in the Formula Editor.   One of the functions is Count() which counts the number of records.   The parameters are
       Count(fld),   Count(fld,condFld) or Count(fld,condFld,value).

Is there any way to do this.   I tried making a new formula field called TYPEAT such that
     if TYPE="A" then
         formula = true
    end if

then I tried a second formula field typeac
Thinking that TYPEAT IS NOW A CONDITIONAL FIELD.   The formula editor will not accept this.

I can use parameter fields and perform the calculations in the main program, but i would like to use a conditional count formula.    

Can this be done with Crystal Reports????
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I assume you are selecting the fields when you build the summary.

Have you tried right clicking the field
Can you insert a summary?

To summarize on a condition field it needs to be a group in the report.

Another way to do this would be

     if TYPE="A" then
         formula = 1
    end if

You can then insert a summary as a sum to get the count.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
knk53Author Commented:
Thanks for responding
  I was already able to use a formula such as you suggested and return 1 or 0, then make another field that would SUM the first field.  However, that means I need to make 2 fields for each conditional count I want in my report.   The first field would return 1 or 0 based on the the condition.  The second field would sum the first field.  
Is there any way to create this as a single field, as opposed to 2 separate fields.
Unless you are grouping by the formula you tried, no.

I'm not sure what you mean by "create this as a single field".  If you're trying to have one "field" produce a count for each TYPE, then, like mlmcc, I don't see any way to do it unless you're grouping on the TYPE, in which case you could show a count for each TYPE in the group footer.

 FWIW, in addition to mlmcc's suggesting of using formulas to produce a count of each TYPE, another option is to use running totals.  Running totals allow you to specify conditions, like only increment when TYPE is a certain value.  So, you'd have one running total for each value in TYPE.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.