Alteryx Designer Desktop Discussions

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

IF ELSEIF Invalid Type in Operator ==

jlrouquette
7 - Meteor

I'm getting the "invalid type in operator" error for this formula. I'm not sure what isn't correct about the way it's written.  MaxProbability is being generated by a formula to pulls the max value across the five respective columns for a single row.  In a new column, I would like to generate the output from the formula below.        

 

IF [MaxProbability] = [FinalScore_E] THEN 'E'
ELSEIF [MaxProbability] = [FinalScore_D] THEN 'D'
ELSEIF [MaxProbability] = [FinalScore_C] THEN 'C'
ELSEIF [MaxProbability] = [FinalScore_B] THEN 'B'
ELSEIF [MaxProbability] = [FinalScore_A] THEN 'A'
ELSE 'ERROR'
ENDIF 

 

9 REPLIES 9
Inactive User
Not applicable

Nothing wrong with formula; one of those fields either the max prob or the finalscore fields is a string. You are having a data type mismatch where you are setting equals from an integer/double to a string. ToString() or ToNumber() the appropriate field and you will get the result you are after.

jlrouquette
7 - Meteor

Awesome, thank you!

JP23
7 - Meteor

Thanks, this was super helpful!

mgarcia174
5 - Atom

I was having a similar issue and this resolved it. Thanks, super helpful!

tk123
6 - Meteoroid

So what is the actual solution?

Marko1986
7 - Meteor

I tried your solution but it is not correct for my problem. All fields that I want to use are double, and still I have invalid type in operator error.

Problem in attachment

BenMoss
ACE Emeritus
ACE Emeritus

In your formula you need to take the = "0" out of qoutes, it should be = 0

 

Ben

Shelaj
6 - Meteoroid

Really Helpfull...........Thanks

namans0297
5 - Atom

Thanks, Super helpful :)

 

 

Labels