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!

Not Like Function

Status
Not open for further replies.

mckenneyj

MIS
Jun 1, 2002
96
Can someone tell me the syntact for using NOT LIKE
Here is the snipet used
if {CASE_FEE.FDICN_DESCRIPTION} LIKE "RC" then "Replied Correct" else
if {CASE_FEE.FDICN_DESCRIPTION} NOT LIKE "RC" then "Reply Incorrect"

I know I could leave the seconf line off but need to incorporate for furture editions by changing to CASE stmt

Thanks,
John McKenney
Work Hard... Play Harder
 
Try:

if {CASE_FEE.FDICN_DESCRIPTION} LIKE "RC" then "Replied Correct" else
if not({CASE_FEE.FDICN_DESCRIPTION} LIKE "RC") then "Reply Incorrect"

Since you're checking the same field for the true or false of the exact same condition, you don't need the NOT clause, just use:

if {CASE_FEE.FDICN_DESCRIPTION} LIKE "RC" then "Replied Correct"
else
"Reply Incorrect"

Also I see that you're not using any wildcards in the like, you might want to describe what you are trying to do as a formula such as the following might be what you want:

if {CASE_FEE.FDICN_DESCRIPTION} LIKE "*RC*" then "Replied Correct"
else
"Reply Incorrect"


-k
 
sorry meant to use wildcards
how would I use this in a case stmt
Here's what I have: (which obviously is wrong)

Select {CASE_FEE.FDICN_DESCRIPTION}
Case LIKE "*RC-*": "Replied Correct"
Case LIKE "*PD-*": "Postage Due"

Default : "Reply Incorrect"

Thanks,
John McKenney
Work Hard... Play Harder
 
Not sure why you need to use a case, ifs work fine here and I doubt that there's a huge performance it, if any.

So use:

if {CASE_FEE.FDICN_DESCRIPTION} LIKE "*RC*" then "Replied Correct" else
if not({CASE_FEE.FDICN_DESCRIPTION} LIKE "*blah*") then "Reply Incorrect"
else
if .....
else
"blah"

if you are concerned about performance than take a datacentric approach to this and either build a reference table on the database to join them to get the descriptions, or use A SQL Expression and do the logic in there.

If you post technical information you'll get better results:

Crystal versions
Database/connectivity used

-k
 
This will work fine
I just normally prefer cases stmts where conditions are likely to grow.
coding is cleaner

Consdier this thread cloased and thanks to all



Thanks,
John McKenney
Work Hard... Play Harder
 
I don't blame you, the readability is much better, but I don't think that you can use a CASE in this instance.

Again, you can probably use a SQL Expression depending upon the database and it will prove faster, and if your database supports a CASE statement you can use it there.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top