community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Multiple AND and CONTAINS in IF THEN Statement

Highlighted

Hi All,

 

In the Formula Tool I'm trying to use the following IF THEN statement to update BRAND but it's not working properly.  X and Z are changed to "ALL STILL XLIC":

 

if !CONTAINS([BRAND],"X") && contains([CARBONATION],"NON") && contains([TYPE],"XLIC")
then "ALL STILL XLIC"
ELSEif !CONTAINS([BRAND],"Z") && contains([CARBONATION],"NON") && contains([TYPE],"XLIC")then "ALL STILL XLIC"
else [BRAND] endif

 

Is it not possible to have three conditions in the  statement?  

Magnetar

I would put parentheses around certain things I want to segregate....

IF (!contains(......)) && etc....

Does that help?  If so, then we've learned something about Alteryx's order of operations.

Bolide

Hi @danielasmith,

 

Think about it this way, your X is passing through your first if statement, but it is being caught in your elseif statement, and is therefore label 'ALL STILL XLIC'. Similarly, your Z is being caught in the first if statement. I think what you really want is to have all four conditions in one line: 

 

if !CONTAINS([BRAND],"X") && !CONTAINS([BRAND],"Z") && contains([CARBONATION],"NON") && contains([TYPE],"XLIC")
then "ALL STILL XLIC"

else [BRAND] endif

 

Best,

mmenth

Thanks!  I am trying this now!  Will let you know if it works.  

Labels