Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Conditional IF statement, Invalid type in operator >

dbyfield
8 - Asteroid

Hi All,

 

I'm a newbie to Alteryx so please bear with me if this is has an obvious answer.

 

I'm trying to convert a set of values (ages) into defined groupings using the Formula tool (code I've written is copied below). The output is a new column rather than changing the existing Metadata.

 

I'm being given an error that reads "Parse error at char (0): invalid type in operator >. (Expression #1). The first "If" in red below is being underlined in the formula window.

 

IF [16. Age] < "25" && [16. Age]>= "18" Then "18 to 24"
ELSEIF [16. Age] > "24" && [16. Age] < "35" then "25 to 34"
ELSEIF [16. Age] > "34" && [16. Age] < "45" then "35 to 44"
elseif [16. Age] > 44 && [16. Age] < 55 then "45 to 54"
ELSEIF [16. Age] > 54 && [16. Age] < 65 then "55 to 64"

ELSEIF [16. Age] > 64 then "65+"
ELSE "#N/A"
ENDIF

 

Essentially what I want to do is for a column to be inserted that enters a group name related to an age (i.e. 24 would equal "18 to 24").

 

I'm sure it's something fairly simple and obvious that I'm missing but any help that can be offered to a newbie would be much appreciated.

4 REPLIES 4
LordNeilLord
15 - Aurora

Hi @dbyfield,

 

Presuming your [16. Age] field is a number (Int, Double etc...) then you don't need the " " around the numbers (those are for string types only) hence the error

dbyfield
8 - Asteroid

Ah I see! the Age fields was set to Vstring but as soon as changed to Int16 and removed the quotation marks and the error went away.

 

Thanks very much for your help!

shai
5 - Atom

I have same issue I did the same, but I still see the same error

dbyfield
8 - Asteroid

Hi @shai 

 

What error are you seeing?

 

Also if you could post the formula I may be able to assist.

 

thanks

Labels