Free Trial

Alteryx Designer Desktop Discussions

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

Issues with Malformed IF statement

Orlando_Castillo
5 - Atom

I am trying to create a new table with conditions , considering all the data is String type and having the current code, how can I fix this error?

7 REPLIES 7
alexnajm
18 - Pollux
18 - Pollux

You don’t need any sort of condition after ELSE - you just need the string value at the end. The ELSE statement captures everything that the previous conditions don’t cover. 

alexnajm
18 - Pollux
18 - Pollux

… ELSE ‘>2501’ ENDIF

Orlando_Castillo
5 - Atom

Thank you for the answer, it would look something like this?

Screenshot 2023-12-09 192415.png

 

alexnajm
18 - Pollux
18 - Pollux

Yes correct. In addition, I noticed your second condition doesn’t match the same format as the first. Make sure to match it similarly with the THEN part!

 

if you paste the formula in the thread, I could edit it more easily!

Orlando_Castillo
5 - Atom

I thank you very much for your assistance, the THEN turned out to be the main issue, but the ending formula does not create the new table properly.

 

IF IsNumber([Score]) >= 0 AND IsNumber([Score]) <= 1500 THEN "<1500"

ELSEIF

IsNumber([Score]) >= 1501 AND IsNumber([Score]) <= 2500 THEN "1501-2500"

ELSE
">2501"


ENDIF

 

results in 

Screenshot 2023-12-09 202501.png

Wich is not supposed to be the case. Do i still need to put another condition, or am I doing something wrong here?

 

alexnajm
18 - Pollux
18 - Pollux

I would look at your Score values then and adjust the IF statement accordingly!

Orlando_Castillo
5 - Atom

That did it, it was the data type in the end. Thank you so much for your help!!!

Labels
Top Solution Authors