Alteryx Designer Desktop Discussions

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

If Statement not working

kfishtd
5 - Atom

Hi,


I have this field, Franchise Loans, that can have 3 possible values - NULL, 00000000, or some number. I want to call out where there is a number.

 

I have this IF statement: IF ([FRANCHISE_LN] != '00000000' OR !IsNull([FRANCHISE_LN])) THEN 'Y' ELSE 'N' ENDIF where it should be calling out where it's not the 00000000 or NULL value and only flag Y where that does not happen but instead it flags Y for every single value, including where it is NULL or 00000000.


How do i fix this?

6 REPLIES 6
MilindG
12 - Quasar

Instead of OR, change it to AND

JamesCharnley
13 - Pulsar

@kfishtd This is a confusing part of using ! in formulas. The problem here is that you need to be using AND instead of OR in your formula.

 

JamesCharnley_0-1667400571584.png

 

DataNath
17 - Castor

@kfishtd this should be AND instead of OR

 

DataNath_0-1667400589961.png

 

To explain what's going wrong in your current approach, in the case of 00000000 - this satisfies the !IsNull() check and in the case of the null, this satisfies the != '00000000' check. The other values satisfy both of these and therefore everything is currently flagged as 'Y'.

IraWatt
17 - Castor
17 - Castor

Hey @kfishtd,

Is this the result you are looking for:

IF [FRANCHISE_LN] = '00000000' OR  [FRANCHISE_LN] = NULL() THEN 'Y' ELSE 'N' ENDIF

IraWatt_0-1667400649728.png

The community has some quick and easy videos on formulas and the Formula Tool here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Writing%20...

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

binuacs
20 - Arcturus

@kfishtd One way of doing this

!IsNull([FRANCHISE_LN]) AND [FRANCHISE_LN] != '00000000'

 

binuacs_0-1667400751620.png

 

kfishtd
5 - Atom

Thank you all! I was missing doing an AND rather than an OR which is somewhat confusing when it isn't truly an AND logic statement it only is since its doing a double negative essentially

Labels