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

count results of formula

Status
Not open for further replies.

sorchard2000

Technical User
Aug 3, 2004
57
US
Crystal 8.5
SQL server

I have a report that has:
Group Header 2: date (by day)
Details band:
I have created a formula called @PtTypeAbbr (in the details band) that looks like:

if{case_volume.pattype_abbr} = "E" then "O"
else if{case_volume.pattype_abbr} = "I" then "I"
else if{case_volume.pattype_abbr} = "K" then "I"
else if{case_volume.pattype_abbr} = "L" then "O"
else if{case_volume.pattype_abbr} = "M" then "O"
else ""

I would like to create another formula (if appropriate) that would count each "I" and "O" that result from the @PtTypeAbbr formula. I would like the count formula to post results in the GH 2 (by day) AND also a grand total of of the "I" and "O" in GH 1 for that date range (such as a month at a type as dictated by parameter set by end user.)

I hope this is doable.

Thanks ahead for any help received!

sorchard2000
 
Dear sorchard2000,

First, might I recommend the select case formula which I believe is easier to read.

//@PTTypeAbbr
Select {case_volume.pattype_abbr}
Case 'I','K' : 'I'
case 'L','M' : 'O'
default : 'Error not defined'

Since you only have two values that you are checking then the easiest thing for you to do is to create two formulas.

//CNTR_PTTYPE_I
if isnull({case_volume.pattype_abbr})
then 0
else if {@PtTypeABBR} = 'I'
then 1
else 0

//CNTR_PTTYPE_O
if isnull({case_volume.pattype_abbr})
then 0
else if {@PtTypeABBR} = 'O'
then 1
else 0

Now, you can put those fields into the detail section and sum them by group, get a grand total for the report and chart on them.

Regards,

ro



Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Thanks SO much! It worked perfectly!
I appreciate it!

sorchard2000
 
Dear Sorchard,

You are very welcome.

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top