Copy link to clipboard
Copied
hi
i'm trying to use multiple expressions in a cfif
ex:
<cfif (Evaluate(test.itemcode) is not "HDMI") OR (Evaluate(itemcode) is not "DVI")>
this should result in returning everything that 's not with hdmi or dvi , right? it doesn't , it returns everything including them
but when I do:
<cfif (Evaluate(test.itemcode) is not "HDMI")>
it excludes the hdmi from the list...
what am I doing wrong?
Copy link to clipboard
Copied
Don't use evaluate! And I think you should be using an AND instead of an OR (I might have misunderstood your requirements though)
<cfif test.itemcode is not "HDMI" AND itemcode is not "DVI">
Copy link to clipboard
Copied
Then why does the evaluate work if there's only 1 requirement?
Or it has to be.. i want to exclude the hdmi and dvi
Verzonden vanaf Samsung Mobile
<div
Copy link to clipboard
Copied
ok , i did a litle more testing... as I thought already , the evaluate didn't do anything wrong and is needed because of some other code...
you were right on the other hand on the OR ... i changed it to AND ... and magic happened.... still baffled why though...
if i was writing diagrams it would've been or... because:
if the item in the loop is not hdmi or dvi or ....
do this
so it seemed more logical to me that way
Copy link to clipboard
Copied
I very much doubt that evaluate() is really required. There's usually better ways to do the same thing, and is generally considered bad practice to use it among CF developers these days.
Regardless, yes, you're correct. The problem was really bad boolean logic. Replacing OR with AND is correct.