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 and "is like"

Status
Not open for further replies.

JonathanNYC

IS-IT--Management
Mar 29, 2003
111
US
I am searching for the word "left" in a procedure modifier field. Procedure modifier is used to denote laterality in surgical procedures.

I suspect that I need an "is like" expression to search for the word "left" because often there is more than just the word "left" or "LEFT" or "left" in the procedure modifier field. E.g., the modifer may indicate "Left Removal Pins" or some other description with the word left in it.

Requesting any ideas for modifying the if expression to search for anything that is like "left" or is like "Left" or is like "LEFT".

My existing statement is:

if {pcmProcedure.descriptMod} = "Left" then "LT" else
if {pcmProcedure.descriptMod} = "LEFT" then "LT" else
if {pcmProcedure.descriptMod} = "left" then "LT" else
"Not applicable"

I am using Crystal reports 10.0
 
I would use a SQL expression {%procmod}:

{fn ucase(pcmProcedure.descriptMod)}

Then set up your record selection formula like:

{%procmod} like "LEFT"

-LB
 
Sorry, that should have been:

{%procmod} like "*LEFT*"

-LB
 
Whether you need to search for upper vs. lower vs. propercase is dependent on the database, which you didn't bother to share.

LB's solution shouldwork nicely in those instances.

If you're only looking for the first 4 characters to say left, then use:

left({table.field},4) = "Left"

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top