HOW TO

Populate a field with a portion of the values from a different field using the Calculate Field tool in ArcGIS Pro

Last Published: June 9, 2022

Summary

In ArcGIS Pro, it possible to populate a field with a portion of the values from a different field. For example, if the field value is 'house_name' or 'country_name', the new field can be populated with 'house' or 'country', respectively. This article describes the workflow to extract characters from a string field and populate them in a different field using the Calculate Field tool in ArcGIS Pro.

Procedure

  1. In ArcGIS Pro, on the top ribbon, click Analysis >Tools.
  2. In the Geoprocessing pane, search for the Calculate Field tool.
  3. In the Calculate Field tool pane, under Parameters, select the layer for the Input Table. In this example, 'malaysia_highway' is selected.
  4. Select an existing field or create a new field for Field Name (Existing or New). Move to Step 6 if an existing field is selected.
  5. For the newly created field, for Field Type, select the Text data type. Refer to ArcGIS Pro: ArcGIS field data types for more information.
  6. For Expression Type, select Python 3.
The Calculate Field Geoprocessing pane to fill in the parameters
  1. In the Expression text box above the code block, enter one of the three scripts described below.
Note:
An array starts from zero (0) as the first position.
  • Use this script to allow multiple characters to be extracted within the specified range.
!Field_Name![X:Y]
  • Use this script to extract a character from a specific position from the left.
!Field_Name![X]
  • Use this script to extract a character from a specific position from the right.
!Field_Name![-X]
  1. Click Run.
he Calculate Field Geoprocessing pane to input the expression and run the script

Article ID: 000027660

Software:
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 7 x
  • ArcGIS Pro 2 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options