Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Multi-Condition IF THEN ELSE statement with the hierarchical relation between "and" & "or"

LeiCheng
8 - Asteroid

Hi, I met a problem that how to use condition if, when first meet or operator, then and operator, then get the result. like this :

if (contains("Ray",[A])  or [B]="003") and contains("Cheng") then "T" elseif contains("666",[D]) and [E]=0  then "A" ELSE "F" ENDIF

 

to get the "Expected Result"

Alteryx does accept my logic formula.  Can someone solve this problem? Sorry, I am using 2018 version of Alteryx. Can not open the latest version file. Can you insert photo of the solving process by Alteryx?

 screen cap.jpg

 

Best Regards,

Lei

5 REPLIES 5
JosephSerpis
17 - Castor
17 - Castor

Hi @LeiCheng I mocked up a workflow that produces the output you describe. I used the syntax IF [A]="Ray" or B="003" and [C]="Cheng" THEN "T" ELSEIF [D]=666 and [E]=0 THEN "A" ELSE "F" ENDIF

LeiCheng
8 - Asteroid
@JS420, many thanks. I am quite new for Alteryx. And I have a further inquiring. IF ([A]="Ray" or B="003") and ([C]="Cheng" or [C]="Yang") THEN "T" ELSEIF [D]=666 and [E]=0 THEN "A" ELSE "F" ENDIF How to express by Alteryx: first the two OR hierarchy, and then the And hierachy?
JosephSerpis
17 - Castor
17 - Castor

Hi @LeiCheng this syntanx should assist with that scenerio IF [A]="Ray" or B="003" and [C] In ("Cheng","Yang") THEN "T" ELSEIF [D]=666 and [E]=0 THEN "A" ELSE "F" ENDIF

 

I use an In function which will search for all the parameters I input e.g. Cheng and Yang. 

LeiCheng
8 - Asteroid

Hi, @JosephSerpis . It works! Thanks a lot!

estherb47
15 - Aurora
15 - Aurora
Hi Lei,

The arguments in your contains statement are reversed. First comes the
field, then what you’re looking to match. The contains with “Cheney” is
also missing the field to analyze.

That’s what I caught quickly. Not on my computer currently to check.

Let me know if that helps!

Cheers,
Esther
--
Esther Bezborodko
*Senior Manager*
201.650.7314 | estherbezborodko@gmail.com
beautycounter.com/estherbezborodko

*Our mission is to get safe products in the hands of everyone.*
[image: Facebook]
Labels