1

I have a table with two fields. One field (type short) is empty. One field (type string) is full of digits. There are no random characters in that field, just digits. I want to convert the string digits into integers and put them in the empty field.

How do I do this in the field calculator?


Figured it out. The strings of digits were 8 digits long. That would make an integer too large for a type short. I made a new field of type long and field calculator converted it easily.

1
  • You can just calc them equal to each other. The values should be cast automatically.
    – Paul
    Commented Jun 13, 2018 at 16:57

2 Answers 2

1

Open field calculator on the blank column and set the parser to python

Find the existing (string) column header on the left panel and double click it to bring the field name into the code block. Then click ok, this will copy all values from the string column into the short type column.

2
  • Doesn't work. when I try that I get an error. The Results console says "The value type is incompatialbe with the field type"
    – Bob Dole
    Commented Jun 13, 2018 at 17:23
  • you said you had spaces in the original field? you can confirm all values are in fact integers with no string characters
    – NULL.Dude
    Commented Jun 13, 2018 at 18:17
1

String to Integer using Field calculator (VB Scribt)

As mentioned in ArcGIS Technical Support

You can convert the string field to integer by doing the following:

Right-click on your integer field >> Field calculator >> (VB Scribt) then just choose your string field from the fields box

 =[FieldName]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.