• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfif with or problem

Explorer ,
Nov 28, 2013 Nov 28, 2013

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?

Views

537

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 28, 2013 Nov 28, 2013

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">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2013 Nov 28, 2013

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2013 Nov 28, 2013

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 28, 2013 Nov 28, 2013

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation