Topic
  • 4 replies
  • Latest Post - ‏2012-12-10T20:58:14Z by JasonJava
JasonJava
JasonJava
19 Posts

Pinned topic Is there an easy way to determine whether the input field is a number ?

‏2012-11-14T00:39:49Z |
I am new to WTX, this question might have an easy answer. Since ISNUMBER() only test against 0-9, it cannot process my input data properly.

INPUT:

42.183
NON-REACTIVE
787
.24
20120225 18:00
-34.83
-0.23

Output

42.183 is a number
NON-REACTIVE is NOT a number
787 is a number
.24 is a number
20120225 18:00 is NOT a number
-34.83 is a number
-0.23 is a number

I had to use the following mapping to get the output, is there an easy way to do this ?

=IF(ISNUMBER(IF(FIND(".", TEXT(TEXTTONUMBER(In1)))!=0, SUBSTITUTE(TEXT(TEXTTONUMBER(In1)),".",""), In1 )),In1+" is a number",In1+" is NOT a number").

WTX PI zip attached. Thanks for any suggestion.
Updated on 2012-12-10T20:58:14Z at 2012-12-10T20:58:14Z by JasonJava
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: Is there an easy way to determine whether the input field is a number ?

    ‏2012-11-14T16:05:09Z  
    The easy way is to let the type tree do the work. See attached example (wtx8.4) - drop these files into your existing Examples folder. The tree uses a choice group to distinguish between the numeric and non-numeric items, and this allows you to easily identify them in your map rules.
  • SystemAdmin
    SystemAdmin
    6184 Posts

    Re: Is there an easy way to determine whether the input field is a number ?

    ‏2012-12-10T14:44:28Z  
    I think you can try this way too

    IF(ISNUMBER(LEAVEALPHANUM(Input))

    Exmaple :

    -3.456 it will check for alphanum i.e "-" & "." = 3456 . Then it will check for 3456 = it is number field.
  • JasonJava
    JasonJava
    19 Posts

    Re: Is there an easy way to determine whether the input field is a number ?

    ‏2012-12-10T20:55:59Z  
    I think you can try this way too

    IF(ISNUMBER(LEAVEALPHANUM(Input))

    Exmaple :

    -3.456 it will check for alphanum i.e "-" & "." = 3456 . Then it will check for 3456 = it is number field.
    Thanks, I have tried that before using

    =IF(ISNUMBER(LEAVEALPHANUM(In1)), In1+" Y", In1+" N").

    Since it has 20120225 18:00, the result for that one is incorrect.

    42.183 Y
    NON-REACTIVE N
    787 Y
    .24 Y
    20120225 18:00 Y
    -34.83 Y
    -20 Y
    -0.23 Y
  • JasonJava
    JasonJava
    19 Posts

    Re: Is there an easy way to determine whether the input field is a number ?

    ‏2012-12-10T20:58:14Z  
    I think you can try this way too

    IF(ISNUMBER(LEAVEALPHANUM(Input))

    Exmaple :

    -3.456 it will check for alphanum i.e "-" & "." = 3456 . Then it will check for 3456 = it is number field.
    The simplest one works for me is

    =IF(CSIZE(TEXT(TEXTTONUMBER(In1)))>0, In1+" Y", In1+" N")