Free Trial

Alteryx Designer Desktop Discussions

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

Invalid Operator == and/or Parse error for ELSEIF function

jb09608
5 - Atom

Hello, I've read through all the posts I could find on the issue I'll discuss below, but none of the solutions work. I am trying to run an ELSEIF function to consolidate different names of products into an overall umbrella (see screenshots), however I am running into an error whenever I try adding the ENDIF portion of the function where it makes the function black text up to a certain point. Here are the solutions I've tried:

 

- closing Alteryx and reopening

- insuring all fields are the same type (VW String)

- split into separate formulas to reduce character cound, but ran into the same issue

- checked all booleans to insure no extra spaces around them

- cleansed the data several times

 

I'm at a bit of a loss on what else to try as the data seems clean and I feel like I've double checked all I can. Thanks for the extra set of eyes. 

9 REPLIES 9
Qiu
21 - Polaris
21 - Polaris

@jb09608 
You should use the In operator

Value IN Operators
Value IN (...) - Keyword
IN (): (Test Value in List) Determines if a given value matches any value in a subquery or a list.
apathetichell
19 - Altair

I have discussed this in previous threads. It looks like you have [field]='value1' or 'value2' --- this is incorrect. it is a boolean expression which reads [field]='value' or (boolean field if value2 is boolean) --- not [field]='value1' or [field]='value2' which presumably you want. the correct way is to use an In statement as @Qiu correclty points out. The syntax is [field] in ('value1','value2'...'valueN') 

jb09608
5 - Atom

Can either of you provide an example including my data? I'm not familiar with IN operator. 

Qiu
21 - Polaris
21 - Polaris

@jb09608 
I can take a look if you could share some workflow or sample data.

apathetichell
19 - Altair

@Qiu is too nice here --- but too summarize you are asking us to transcribe your screen grab of your data because you don't want to upload your data - but you want us to fix things for you?

jb09608
5 - Atom

I'm by no means asking you to fix things for me. I was asking for a brief example using a portion of my data, so that I could understand how to use that function as when you go to alteryx's page it says very little and no example is provided. 

 

IF [Capture Products1]="Advantage 7 Stock" THEN "Advantage 7"

ELSEIF ([Capture Products1]=("Advantage Stock" OR "Advantage+® Stock" OR " Advantage+™")) THEN "Advantage (AA and AA+)

ELSEIF [Capture Products1]="Benefit Control Stock" THEN "Benefit Control"

Deano478
12 - Quasar

@jb09608 I believe what @Qiu was saying was to try and expression like so

IF [Capture Products1] = "Advantage 7 Stock" THEN "Advantage 7"
ELSEIF [Capture Products1] IN ("Advantage Stock", "Advantage+® Stock", "Advantage+™") THEN "Advantage (AA and AA+)"
ELSEIF [Capture Products1] = "Benefit Control Stock" THEN "Benefit Control"
ELSE ""
ENDIF
jb09608
5 - Atom

This worked perfectly - thank you for the help ya'll!

Qiu
21 - Polaris
21 - Polaris

@Deano478 @apathetichell 
Thank you for sorting this out. 😁

Labels
Top Solution Authors