Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

IF Statement not working

purplespirit
5 - Atom

formula used to work but it doesn't anymore ... get the "Parse Error at char(0): Invalid Type in operator >.(Expression #1)

 


IF [Year Built] <= "1969" THEN "0000 - 1969"
ELSEIF
[Year Built]> "1969" && [Year Built] <= "1979" THEN "1970 - 1979"
elseif
[Year Built]> "1979" && [Year Built]<="1999" then "1980 - 1999"
elseif
[Year Built]>"1999" && [Year Built]<="2010" then "2000 - 2010"
elseif
[Year Built]>"2010" && [Year Built]<="2020" then "2011 - 2019"

ELSE ">=2020" ENDIF

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@purplespirit 

This means your [Year Built] column is a Numeric anymore.

You are comparing it to a string since you put " ".

Can you check by metadata?

 
 
 
 

Capture13.PNG

purplespirit
5 - Atom

Alteryx says it's a "double" ...isn't a double numeric?

Qiu
21 - Polaris
21 - Polaris

@purplespirit 

I am sorry, I had a typo earlier.

Your [Year Built] column should be String Type.

 

So two options,

1. Use select tool to change it to V_String

2. Remove the " in read part

IF [Year Built] <= "1969" THEN "0000 - 1969"
ELSEIF
[Year Built]> "1969" && [Year Built] <= "1979" THEN "1970 - 1979"
elseif
[Year Built]> "1979" && [Year Built]<="1999" then "1980 - 1999"
elseif
[Year Built]>"1999" && [Year Built]<="2010" then "2000 - 2010"
elseif
[Year Built]>"2010" && [Year Built]<="2020" then "2011 - 2019"

ELSE ">=2020" ENDIF




"

Tyro_abc
11 - Bolide

Hi @purplespirit 

Please check this workflow

arundhuti726_0-1613691957868.png

 

Labels