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

If Statement 2

Status
Not open for further replies.

JonathanNYC

IS-IT--Management
Mar 29, 2003
111
US
For a report pertaining to laterality, I am trying to extract “left”, “right” or “bilateral”.
Left and right are indicated only in the “descriptMod” field, however, “bilateral” may be indicated in either the “descriptMod” and/or the “proceduredescription” field.

Thus far I can not get “formula 1” (see below) to report on bilateral when it may occur in the proceduredescription field. Obviously, some major error in my formula. As a workaround, I created “formula 2” which is able to correctly report on bilateral in the proceduredescription field. Even when I insert formula 2 into formula 1 it does not work.

Help, please, in combining this into one formula. I am using Crystal 10 and a database called PSSolutions.

Formula 1
if {pcmProcedure.descriptMod} = "BIL" then "B" else
if {pcmProcedure.descriptMod} = "bilateral" then "B" else
if {pcmProcedure.descriptMod} = "BILATERAL" then "B" else
if {pcmProcedure.descriptMod} = "Bilateral" then "B" else
if {pcmProcedure.descriptMod} = "Left" then "LT" else
if {pcmProcedure.descriptMod} = "LEFT" then "LT" else
if {pcmProcedure.descriptMod} = "left" then "LT" else
if {pcmProcedure.descriptMod} = "Right" then "RT" else
if {pcmProcedure.descriptMod} = "RIGHT" then "RT" else
if {pcmProcedure.descriptMod} = "right" then "RT" else
if {pcmProcedure.procedureDescription} = "BILATERAL" then "B" else
if {pcmProcedure.procedureDescription} = "bilateral" then "B" else
if {pcmProcedure.procedureDescription} = "Bilateral" then "B" else
"Not applicable"

Formula 2
if instr({pcmProcedure.procedureDescription} ,"BIL") > 0 then "B"
 
Try:

if "BIL" in uppercase({pcmProcedure.descriptMod}) then
"B"
else
if "LEFT" in uppercase({pcmProcedure.descriptMod}) then
"LT"
else
if "RIGHT" in uppercase({pcmProcedure.descriptMod}) then
"RT"
else
"Not applicable"

-k
 
Thanks synapsevampire.
Much much cleaner then my formula.
It accurately gives me the laterality from the "descriptMod" field.
Is there a way I can include in this single formula the check for laterality (the search for the word bilateral) in the procedure description field?
 
Try this one to get it to look at your procedureDescription field too:

if "BIL" in uppercase({pcmProcedure.descriptMod}) then
"B"
else
if "BIL" in uppercase({pcmProcedure.procedureDescription}) then
"B"
else
if "LEFT" in uppercase({pcmProcedure.descriptMod}) then
"LT"
else
if "RIGHT" in uppercase({pcmProcedure.descriptMod}) then
"RT"
else
"Not applicable"

I suspect that your original formula may be hitting a "Left" or "Right" in the descriptMod field prior to getting to the part that looks at procedureDescription. If statements are only evaluated to a point where they find a result. So, for example, if you have "Left" in descriptMod and "Bilateral" in procedureDescription, your original If statement would find the "Left" first and not evaluate any further.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Try:

if "BIL" in uppercase({pcmProcedure.descriptMod})
or
"BIL" in uppercase({pcmProcedure.procedureDescription})
then
"B"
else
if "LEFT" in uppercase({pcmProcedure.descriptMod}) then
"LT"
else
if "RIGHT" in uppercase({pcmProcedure.descriptMod}) then
"RT"
else
"Not applicable"

-k
 
Thanks hilfy and synpapsevampire.
Using both your suggestions and with one small tweak in the order of things (based on what you told me about if statements) it works perfectly.

Here was the final formula that worked:

if "BIL" in uppercase({pcmProcedure.procedureDescription}) then
"B"
else
if "BIL" in uppercase({pcmProcedure.descriptMod}) then
"B"
else
if "LEFT" in uppercase({pcmProcedure.descriptMod}) then
"LT"
else
if "RIGHT" in uppercase({pcmProcedure.descriptMod}) then
"RT"
else
"Not applicable"


My sincere thanks for your helpful and timely response.
Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top