Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

IsNumber does not seem to work in Alteryx 10.5

mpurdy
8 - Asteroid

Just wondering if someone else could test this as it doesn't appear to be working for me in 10.5? It used to work for Strings (when a integer was formatted as a string) but now it only appears to work for Numbers (when formatted as numbers). Thanks

10 REPLIES 10
JohnJPS
15 - Aurora

IsNumber() will be true for numeric types.  IsInteger() may be what your looking for: that will assess the value rather than the type.

(http://help.alteryx.com/10.5/Reference/Functions.htm#Test)

mpurdy
8 - Asteroid

Thanks. You are right the definition has changed for IsNumber from 10 to 10.5:

 

10 = ISNumber(v) Tests if v is a number or not.

10.5 = ISNumber(v) Tests if the field type for v is a number or not.

 

Have to be careful upgrading! Seems a bit concerning when a function's definition changes so much between releases! I will use IsInteger instead. Thank you again for your help.

Jean_F
6 - Meteoroid

I have to say this clarification was quite helpfull. But how to test if a a String contains a number (which isn't an integer) in Alteryx 10.5 ?

JohnJPS
15 - Aurora

Not at my computer to test this, but one idea is to try converting the string to a number, then back to string, and seeing if the result matches the original string... e.g. [field]==ToString(ToNumber([field]))

 

The theory here is ToNumber will truncate the first non-numeric character and anything following, but it might still work for decimals.

Jean_F
6 - Meteoroid

ToNumber() returns 0 if the field contains no numeric value. So if I use it to test if the field contains or not a number, the result will always be true.

MarqueeCrew
20 - Arcturus
20 - Arcturus
IIF(ToString(ToNumber([field]))==[field],1,0)

This expression converts and tests to see if a string converted to a number and then converted back to a string is the same result.  If it is, then the original value was a number.

 

$123 won't be a number.

123,456 won't be a number.

123.45.5 won't be a number.

 

Thanks,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Jean_F
6 - Meteoroid

Thanks for your answer.

 

That works partially:

- for the values like 19.84, that works

- for the values like 110.0, that doesn't work.

 

> I tried to delete the dot in the field (replace(field,".","")) but I still have the issue... Any help to fixe this would be quite welcome!!!

MarqueeCrew
20 - Arcturus
20 - Arcturus
IIF(tostring(tonumber([field]))==regex_replace([field],"(.*)([.]0{1,2})",'$1'),1,0)

Give that a whirl....

 

123.0 and 123.00 will equate to 123 now.

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Joe_Mako
12 - Quasar

How about

 

 

REGEX_Match([Field1], '\d*\.{0,1}\d+')

         # explanation
 \d       match a digit...
 *        zero or more times
 \.       match literal dot...
{0,1} zero or one time \d match a digit... + one or more times

This produces the following result:

regex out.png

 

Labels