-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")

closed as unclear what you're asking by ahmadhanb, aldo_tapia, Dan C, MaryBeth, tinlyx Mar 20 '18 at 21:24

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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

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

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