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

Null Values - Formula Result 1

Status
Not open for further replies.

govmule

MIS
Dec 17, 2002
90
0
0
US
I'm using Crystal Reports XI and MSSQL 2000.

Working with three fields 1-Type, 2-Subtype, 3-Condition. My formula lables each record based on the various conditions of these fields. If one of the conditions isn't met I want the label to be "Other". My problem is when one of these three fields is null my formula doesn't return a result. I'm expecting it to return "Other". Your help is greatly appreciated.

Here is the formula:
___________________________________________________________

If {kennel.intake_subtype} = "FIELD" and
{kennel.intake_cond} = "DEAD" then "DEAD"
else
If {kennel.intake_type} in ["STRAY", "WILD", "DEAD"] and
{kennel.intake_subtype} = "FIELD" and
{kennel.intake_cond} <> "DEAD" then "STRAY AT LARGE"
else
If {kennel.intake_type} in ["EUTH REQ", "OWN SUR"] and
{kennel.intake_subtype} = "FIELD" then "OWNER SURRENDER"
else
If {kennel.intake_type} = "CONFISCATE" and
{kennel.intake_subtype} = "BITE" then "CONFISCATE BITE"
else
If {kennel.intake_type} = "CONFISCATE" and
{kennel.intake_subtype} in ["EVICTION", "HOSPITAL", "OWNER DIED", "POLICE"] then "CONFISCATE AGENCY ASSIST"
else
If {kennel.intake_type} = "CONFISCATE" and
{kennel.intake_subtype} = "CRUELTY" then "CONFISCATE CRUELTY"
else
If {kennel.intake_type} = "DISASTER" and
{kennel.intake_subtype} in ["FIELD", "LIVESTOCK"] then "DISASTER"
else "OTHER
 
Where would I place that in this formula? There are other conditions (besides one of these fields being null) that also return an "Other" result.

Thank you,

Jack
 
if isnull({kennel.intake_subtype}) or
isnull({kennel.intake_type}) or
isnull({kennel.intake_cond}) then
"OTHER" else
If {kennel.intake_subtype} = "FIELD" and
{kennel.intake_cond} = "DEAD" then "DEAD"
else
If {kennel.intake_type} in ["STRAY", "WILD", "DEAD"] and
{kennel.intake_subtype} = "FIELD" and
{kennel.intake_cond} <> "DEAD" then "STRAY AT LARGE"
else
If {kennel.intake_type} in ["EUTH REQ", "OWN SUR"] and
{kennel.intake_subtype} = "FIELD" then "OWNER SURRENDER"
else
If {kennel.intake_type} = "CONFISCATE" and
{kennel.intake_subtype} = "BITE" then "CONFISCATE BITE"
else
If {kennel.intake_type} = "CONFISCATE" and
{kennel.intake_subtype} in ["EVICTION", "HOSPITAL", "OWNER DIED", "POLICE"] then "CONFISCATE AGENCY ASSIST"
else
If {kennel.intake_type} = "CONFISCATE" and
{kennel.intake_subtype} = "CRUELTY" then "CONFISCATE CRUELTY"
else
If {kennel.intake_type} = "DISASTER" and
{kennel.intake_subtype} in ["FIELD", "LIVESTOCK"] then "DISASTER"
else "OTHER"

This will return OTHER is any of the three fields is null.

-LB
 
lbass - thank you much. I appreciate it. Worked like a charm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top