Enter a String for all the Records of a Field

609
12
Jump to solution
03-29-2017 12:00 PM
AzaN
by
New Contributor III

I have a Text field (Status), which I need to enter a string ('Existing') into all the cells of this field. I have 300 records and prefer to do it via Python or JavaScript. For some reason, I get error messages for my script. Can anyone help me with that? Thanks.

0 Kudos
1 Solution

Accepted Solutions
IanMurray
Frequent Contributor

The only reason this wouldn't work is if your field was not a text field, or your text field character limit was less than 8 characters.

View solution in original post

12 Replies
IanMurray
Frequent Contributor

If you are having issues with a script, it is recommended to post the script and the error so people know where you are going wrong.

http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/calculate-field.htm

arcpy.CalculateField_management("yourfilehere", "Status", 
                                'Existing', "PYTHON_9.3")
‍‍
AzaN
by
New Contributor III

Thanks for your response. I am using the Field calculator. Could you please give the script I should enter into that? By the way, my field name is Status.

0 Kudos
AzaN
by
New Contributor III

My script:

!Status!.str('Existing')

Error message:

There was a failure in processing....

0 Kudos
IanMurray
Frequent Contributor

Try just putting in 'Existing' as your Expression. 

0 Kudos
AzaN
by
New Contributor III

Already did. Same error message.

0 Kudos
IanMurray
Frequent Contributor

The only reason this wouldn't work is if your field was not a text field, or your text field character limit was less than 8 characters.

AzaN
by
New Contributor III

Awesome!  Thank you so much. It worked!

0 Kudos
IanMurray
Frequent Contributor

Sometimes a picture is worth about 25 words....

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Did you try the code posted by iamurray‌, from your original question I think that code should work.

0 Kudos