Alteryx Designer Desktop Discussions

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

Multiple if conditions

Stringer-
5 - Atom

Hi everyone, i've tried searching for a result for my problem but i couldn't find a solution that worked for me, probably because I'm new using Alteryx.

 

I'm trying to do a multiple IF formula to compare a lot of cells, but I'm having a problem that I can't quite understand from where it comes.

 

It's in two parts:

 

If I end my formula with ENDIF all the text in the box becomes black instead of the having the formula colors, like it stops registering the text as a formula and just reads it as text, and the error showing in Data Preview is "Invalid type in operator ==."

 

If I end my formula with END all the colors are as they should be (brownish for cells, pink for the AND, etc..) but i still get an error which says "Malformed If Statement"

 

I've tried looking at the data type values to check if they match but they all seem fine.

 

Thanks in advance to anyone who replies.

5 REPLIES 5
JessieC
Alteryx
Alteryx

@Stringer- 

 

Can you share a screenshot of your formula and your data types?

 

Thanks!

benakesh
12 - Quasar

Hi @Stringer- ,

I think adding 'else' will resolve this error .  You can share your formula if it is not resolved.

KP_DML
8 - Asteroid

Hello,

An IF statement in the formula tool must contain an ELSE statement and terminate with ENDIF. This took me a while to get used to when all I wanted to do was a simple IF > THEN > ENDIF.

 

The "Invalid type in operator ==" can occur when you try to evaluate a value as the wrong type (using/omitting quotes).

 

Examples that would cause the error:

IF [MyNumericField] == "3" THEN

IF [MyNumericField] == "ABC" THEN

IF [MyTextField] == 2 THEN

IF [MyBooleanField] == "true" THEN

 

 

Stringer-
5 - Atom

This was it, i had a problem with the data types.

rliko
5 - Atom

Did you ever resolve this? I'm having a similar problem

rliko_0-1594410829134.png

rliko_1-1594410865696.png

 

Labels