community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
#SANTALYTICS

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More
SOLVED

IsNumber does not seem to work in Alteryx 10.5

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

ACE Emeritus
ACE Emeritus

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)

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.

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 ?

ACE Emeritus
ACE Emeritus

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.

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.

Alteryx Certified Partner
Alteryx Certified Partner
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 reboot. Order shall return.
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!!!

Alteryx Certified Partner
Alteryx Certified Partner
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 reboot. Order shall return.
Highlighted
Quasar
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