ISNUMBER function for ArcGIS Arcade

1236
0
06-15-2021 09:45 AM
Status: Open
feralcatcolonist_old
Occasional Contributor II

Arcade shines brightest when it is used to overcome schema issues out of your control. Using simple tests, one is able to effectively clean/screen data for datasets that are not part of their jurisdiction/responsibility. As part of that strategy, a tool like isNumber() could be used to help screen data.

A specific use-case would be setting angles for cartography, if the only field available is a string, then you can write a test like:

 

WHEN(

ISEMPTY(thefield) == true, 0, //to test for nulls

ISNUMBER(thefield) == true, NUMBER(thefield) , \\to cast the string field

0 //default for records that consist of only text

)

 

The current alternative is below and can be unintuitive for individuals without javascript experience:

 

WHEN(

ISEMPTY(thefield) == true, 0, //to test for nulls

ISNAN(NUMBER(thefield)) == false, NUMBER(thefield),

0 \\default for records that consist of only text

)

 

 

ISNUMBER( value, pattern? )

 

P.S. Shouldn't ArcGIS Arcade have its own Ideas Community?