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

If then Formula 1

Status
Not open for further replies.

JerryJay

Technical User
Jan 27, 2006
24
US
I am using Crystal 8.5 and I have created several If then formulas to replace code(Value Stored in the database) with text. The formula is listed below:

Item 1


If {Incident.Location} = "BA" Then "Bathroom";
If {Incident.Location} = "BE" Then "Bedroom";
If {Incident.Location} = "NULL" Then "NULL";
If {Incident.Location} = "" Then "Living Roo,";
If {Incident.Location} = "VO" Then "Voc Center";
If {Incident.Location} = "OT" Then "Other";
If {Incident.Location} = "KI" Then "Kitchen";
If {Incident.Location} = "VE" Then "Vehicle"

Item 2


If{Incident.Type} = 1 Then "None Apparent";If{Incident.Type} = 2 Then "Bite";If{Incident.Type} = 3 Then "Bone";If{Incident.Type} =4 Then "Bruise";If{Incident.Type} =5 Then "Burn";If{Incident.Type} =6 Then "Chest";If{Incident.Type} =7 Then "Cut";If{Incident.Type} =8 Then "Elopement";If{Incident.Type} =9 Then "Head"

The statement exutes but only returns the last valid argument. If {Incident.Type} =8 the elopement is returned but the If{Incident.Type} = 1 Then "None Apparent" argument does displays notheing. How can I make the formula execute all the arguments.
 
Replace the semicolons with "else".

-LB
 
Actually, upon closer reading, if by 'Null' you mean that the type can be null, then the formula should be set up with null checks first, as in:

If isnull({Incident.Location}) Then "NULL" else
If trim({Incident.Location}) = "" Then "Living Room" else
If {Incident.Location} = "BA" Then "Bathroom" else
If {Incident.Location} = "BE" Then "Bedroom" else
If {Incident.Location} = "VO" Then "Voc Center" else
If {Incident.Location} = "OT" Then "Other" else
If {Incident.Location} = "KI" Then "Kitchen" else
If {Incident.Location} = "VE" Then "Vehicle"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top