Alteryx Designer Desktop Discussions

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

IF CONTAINS Statement with "AND" for same field - getting PARS ERROR AT Char

dattina2287
Asteroide

hI,

 

I am trying to form an IF Contains statement using "and" logic for the same field. I am getting an error message even though the Tool shows everything as correctly in the correct colors. 

 

This is how i am set up:

 

IF CONTAINS([Recipient ECI(s) (Cust Field)],'WAVE 3') AND IF CONTAINS([Recipient ECI(s) (Cust Field)], 'Diana') THEN "Diana"
ELSEIF CONTAINS ([Recipient ECI(s) (Cust Field)],'Wave 3') AND IF CONTAINS ([Recipient ECI(s) (Cust Field)],'Mike') THEN "Mike"
ELSEIF CONTAINS ([Recipient ECI(s) (Cust Field)],'Wave 3') AND IF CONTAINS ([Recipient ECI(s) (Cust Field)],'Mia') THEN "Mia"

ELSE "N/A"
ENDIF

 

The error i receive is "Parse Error at Char (2054):Malformed If statement (expression #1)" However in the tool itself, it looks like there is no error, as i see the colors appearing as if it works. 

 

Is anyone able to tell me if i should be using another statement for what i'm trying to achieve?

 

Thank you!

1 RESPUESTA 1
TimN
Púlsar

You don't need IF after the AND 

 

iF CONTAINS([Recipient ECI(s) (Cust Field)],'WAVE 3') AND CONTAINS([Recipient ECI(s) (Cust Field)], 'Diana') THEN "Diana"
ELSEIF CONTAINS ([Recipient ECI(s) (Cust Field)],'Wave 3') AND CONTAINS ([Recipient ECI(s) (Cust Field)],'Mike') THEN "Mike"
ELSEIF CONTAINS ([Recipient ECI(s) (Cust Field)],'Wave 3') AND CONTAINS ([Recipient ECI(s) (Cust Field)],'Mia') THEN "Mia"

ELSE "N/A"
ENDIF

Etiquetas