Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Another Malformed if Statement

JeffVTR
6 - Meteoroid

Hi 

 

I'm having issues with an if statement and I know it is the highlighted lines. Can anyone please show me what I'm doing wrong? 

 

JeffVTR_1-1675147678804.png

 

 

3 REPLIES 3
ShankerV
17 - Castor

Hi @JeffVTR 

 

The problem is here.

 

Where you have initially created OR correctly but on the remaining you have used 2 or 3.

 

Kindly change to [Moving code] = 2 or [Moving code] = 3.

 

ShankerV_0-1675149227370.png

 

 

Many thanks

Shanker V

DataNath
17 - Castor

Hey @JeffVTR, I actually wrote a blog post on common Formula tool errors which I believe ought to cover the issues here!

 

https://community.alteryx.com/t5/Engine-Works/Troubleshooting-Common-Formula-Expression-Errors/ba-p/...

 

In particular I’d check the fields you’re checking the numeric value for I.e. [Moving Code] are the correct (numeric) data type. Also, where you use ‘OR’, you need to define the field again i.e. [Field] = ‘A’ OR [Field] = ‘B’. Take a look at the section about AND/OR statements not returning the correct results as well because your current syntax will need bracketing too.

JeffVTR
6 - Meteoroid

@DataNath you nailed it in your blog. I searched high and low for something like that and could not find anything on OR being used in IF statements.

 

To summarise, I needed to replicate the text that @ShankerV pointed out and add parentheses to the statement. 

 

You saved my computer monitor @DataNath!

Labels