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

help with STRINVAR & IF,THEN,ELSE

Status
Not open for further replies.

mark12010

IS-IT--Management
Apr 28, 2010
32
US
I have a field in my database called {history_avail_tracking.reason_code}
It has 4 values "DOSING ELSWARE", "INCARCERATED", "INPATIENT"
And "UNAVAILABLE OR DOSE" I am using a STRINGVAR to say if {history_avail_tracking.reason_code} = one of these values to print something different for each value. This works fine, however if the field is not equal to any of these values (blank) I want to make AVAILSTATUS:= “Available”. This part is not working.It just stays blank. Please look at my code and tell me whats wrong.
STRINGVAR AVAILSTATUS ;
IF
{history_avail_tracking.reason_code} = "DOSING ELSWARE"
THEN AVAILSTATUS:= "Unavailable / Guest Dosing Elsware"
ELSE IF
{history_avail_tracking.reason_code} = "INCARCERATED"
THEN AVAILSTATUS:= "Unavailable / Incarcerated"
ELSE IF
{history_avail_tracking.reason_code} = "INPATIENT"
THEN AVAILSTATUS:= "Unavailable / Inpatient"
ELSE IF
{history_avail_tracking.reason_code} = "UNAVAILABLE OR DOSE"
THEN AVAILSTATUS:= "Unavailable / Other Reason For Unavailability"
ELSE
AVAILSTATUS:= "Available"
 
YOu have to deal with NULLS first

IF
isnull({history_avail_tracking.reason_code})
THEN AVAILSTATUS:= "Available"
else
IF
{history_avail_tracking.reason_code} = "DOSING ELSWARE"
THEN AVAILSTATUS:= "Unavailable / Guest Dosing Elsware"
ELSE IF
{history_avail_tracking.reason_code} = "INCARCERATED"
THEN AVAILSTATUS:= "Unavailable / Incarcerated"
ELSE IF
{history_avail_tracking.reason_code} = "INPATIENT"
THEN AVAILSTATUS:= "Unavailable / Inpatient"
ELSE IF
{history_avail_tracking.reason_code} = "UNAVAILABLE OR DOSE"
THEN AVAILSTATUS:= "Unavailable / Other Reason For Unavailability"
ELSE
AVAILSTATUS:= "Available"

Ian
 
Also I see no reason to use a variable here. You could just leave out: "AVAILSTATUS:="

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top