-1

I have two columns in a feature class. One has null values, the other has values. I want the one with values (TEXTSTRING) to be placed into the one without (HouseNumber). I know this is simple, but I can't remember how to make one field equal another within arcpy. Currently the code is as below:

arcpy.CalculateField_management(newFc, "HouseNumber","!HouseNumber! = !TEXTSTRING!", "PYTHON_9.3")
  • 5
    Suggest you read the Help file especially the syntax section then you would realise that what you have is incorrect. Then actually try scrolling to the bottom of the page to the code sample section and study how the tool is called. All geoprocessing tools have code samples. – Hornbydd Mar 20 '18 at 17:39
5

This should do the trick as long as your field types work out.

arcpy.CalculateField_management(newFc, "HouseNumber", '!TEXTSTRING!', "PYTHON_9.3")

I also suggest always checking the ESRI help page when you run into one of these problems. The examples can be super helpful. Calculate Field

| improve this answer | |
1

Using the VB Script parser, after you have opened Field Calculator from the field you wish to modify, click the field you wish to copy. Click 'OK.'

enter image description here

Make sure you have the field property formatted correctly (do you want house number to be a short/long? Or string?).

https://support.esri.com/en/technical-article/000002287 https://support.esri.com/en/technical-article/000002292

| improve this answer | |

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