ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

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

If statement for AND multiple conditions not working

cbabel14
5 - Atom

I am having some issues with part of my coding as I want to fill up the blanks in city column with reference to other columns values in such a way that if city column will be filled up by State[value] else Country[value] or if none of the columns have any value or string it will be filled with "1".

 

the only portion that is not working is the condition where none of the columns have any value or string. it will be indicated as "1" in firm city

 

would greatly appreciate for some guidance

 

cbabel14_1-1617789428875.png 

cbabel14_2-1617789453226.png

cbabel14_3-1617789541343.png

 

 

Code:

if
IsEmpty([city])
then [state]
elseif
IsEmpty([city])&&IsEmpty([state])&&IsEmpty([country])
then "1"
elseif
IsEmpty([city])&&IsEmpty([state])
then [country]

else [city]
endif

Emil_Kos
15 - Aurora

Hi @cbabel14,

 

It will not work as it is checking the first condition and it is met. So it is skipping all of the rest conditions and it will not check if they are true. To make it work you need to swap conditions around

 

if
IsEmpty([city])&&IsEmpty([state])&&IsEmpty([country])
then "1"
elseif
IsEmpty([city])&&IsEmpty([state])
then [country]
elseif
IsEmpty([city])
then [state]

else [city]
endif

 

If I understand the request correctly it should start working for you!

cbabel14
5 - Atom

Hey Emil

 

Alright! it works. That's certainly a very crucial part to take note of! Thanks!

Labels