Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

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
8 - Asteroid

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 REPLY 1
TimN
13 - Pulsar

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

Labels
Top Solution Authors