When I use the following formula, only the first "if" is displayed in my report while the remaining 3 if pieces are not displaying anything. I am using this formula to create a grouping level in my report. When I change the order of the 4 if sections, only the first if section displays data. I think there is something wrong in my formula but can't see what it is. I am using Crystal 7 and I'm connected using SQLl/ODBC connection with tables that were created back in the 1980's in DB2. The field {PHORD.GENERIC} is a generic name for a drug. I am working with a Pharmacy database and this formula is grouping the records into Daily Dosage groups based on how many MG of drug the patient receives per day. Your help is GREATLY appreciated!
FORMULA:
*********
If {PHORD.GENERIC} = "Olanzapine" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 10 Then
ToText("0 - 10 MG"
Else If {@DailyDosage} >= 11 and {@DailyDosage} <=20 Then
ToText("11 - 20 MG"
Else If {@DailyDosage} >= 21 and {@DailyDosage} <=30 Then
ToText("21 - 30 MG"
Else If {@DailyDosage} >= 31 Then
ToText("> 30 MG"
Else
If {PHORD.GENERIC} = "Clozapine" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 300 Then
ToText("0 - 300 MG"
Else If {@DailyDosage} >= 301 and {@DailyDosage} <=600 Then
ToText("301 - 600 MG"
Else If {@DailyDosage} >= 601 Then
ToText("> 600 MG"
Else
If {PHORD.GENERIC} = "Quetiapine" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 399 Then
ToText("0 - 399 MG"
Else If {@DailyDosage} >= 400 and {@DailyDosage} <= 800 Then
ToText("400 - 800 MG"
Else If {@DailyDosage} >= 801 Then
ToText("> 800 MG"
Else
If {PHORD.GENERIC} = "Risperidone" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 4 Then
ToText("0 - 4 MG"
Else If {@DailyDosage} >= 5 and {@DailyDosage} <=6 Then
ToText("5 - 6 MG"
Else If {@DailyDosage} >= 7 Then
ToText("> 6 MG"
FORMULA:
*********
If {PHORD.GENERIC} = "Olanzapine" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 10 Then
ToText("0 - 10 MG"
Else If {@DailyDosage} >= 11 and {@DailyDosage} <=20 Then
ToText("11 - 20 MG"
Else If {@DailyDosage} >= 21 and {@DailyDosage} <=30 Then
ToText("21 - 30 MG"
Else If {@DailyDosage} >= 31 Then
ToText("> 30 MG"
Else
If {PHORD.GENERIC} = "Clozapine" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 300 Then
ToText("0 - 300 MG"
Else If {@DailyDosage} >= 301 and {@DailyDosage} <=600 Then
ToText("301 - 600 MG"
Else If {@DailyDosage} >= 601 Then
ToText("> 600 MG"
Else
If {PHORD.GENERIC} = "Quetiapine" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 399 Then
ToText("0 - 399 MG"
Else If {@DailyDosage} >= 400 and {@DailyDosage} <= 800 Then
ToText("400 - 800 MG"
Else If {@DailyDosage} >= 801 Then
ToText("> 800 MG"
Else
If {PHORD.GENERIC} = "Risperidone" Then
If {@DailyDosage} >= 0 and {@DailyDosage} <= 4 Then
ToText("0 - 4 MG"
Else If {@DailyDosage} >= 5 and {@DailyDosage} <=6 Then
ToText("5 - 6 MG"
Else If {@DailyDosage} >= 7 Then
ToText("> 6 MG"