Select to view content in your preferred language

String to Numeric (11 characters) Issue

971
3
Jump to solution
07-07-2022 02:32 PM
miminuton
New Contributor

Hello,

I am using ArcGIS Pro Version 2.6 and am trying to convert geoid (11 figures) from a string to numeric through the attribute table and calculate field. I have tried the following methods and it creates a new variable with only 10 figures and null values (when there are 11 figures). 

  • To denote that length is 11
  • Calculate field where !variable!
  • .zfill(11)

All of these have left me with many null values and only 10 digits in my number.

Is there any way I can go about doing this?

Thank you so much!

0 Kudos
1 Solution

Accepted Solutions
EvanThoms
Frequent Contributor

Ah! census geographic identifiers, not globe models, right?

I set up a table with the following fields and datatypes

EvanThoms_0-1657230667923.png

and then wrote an 11 character census tract to geoid_string, 48201223100

Running the field calculation 

int(!geoid_string!)

 on each of the fields resulted in:

EvanThoms_1-1657230871249.png

I am guessing you are trying to calculate on a long integer field? Try setting it to double and using the calculation above. 

Read more about the limits on datatypes here:

ArcGIS field data types—ArcGIS Pro | Documentation

View solution in original post

0 Kudos
3 Replies
DavidSolari
MVP Regular Contributor

Are you converting a text field to a long integer field? The maximum value of a long field is (2^31)-1, or 2,147,483,647, which is 9 consistent decimal digits, or 10 in some cases. To store numeric versions of larger numbers, use a "double" field, that gives you 15 consistent decimal digits with no precision loss. Here's a quick field calculator example (the long field is null because the value causes the calculation to fail due to size restrictions):
Screenshot 2022-07-07 145339.png

0 Kudos
EvanThoms
Frequent Contributor

Ah! census geographic identifiers, not globe models, right?

I set up a table with the following fields and datatypes

EvanThoms_0-1657230667923.png

and then wrote an 11 character census tract to geoid_string, 48201223100

Running the field calculation 

int(!geoid_string!)

 on each of the fields resulted in:

EvanThoms_1-1657230871249.png

I am guessing you are trying to calculate on a long integer field? Try setting it to double and using the calculation above. 

Read more about the limits on datatypes here:

ArcGIS field data types—ArcGIS Pro | Documentation

0 Kudos
JayantaPoddar
MVP Alum

Could you share screenshot of how the different string values look like, and explain what portion of string you would like to extract?



Think Location
0 Kudos