HOW TO

Concatenate text and numeric fields in ArcGIS Pro

Last Published: August 9, 2023

Zusammenfassung

In ArcGIS Pro, the Field Calculator tool can be used to concatenate two or more text fields to display the combined field attributes in a new field. In some instances, text and numeric fields must be concatenated into one field to combine the attribute values.

Vorgehensweise

The steps below describe how to concatenate text and numeric fields into a new field using casting in Field Calculator, which converts all the fields to text fields.

In this example, the Name (text), Gender (text), and Student_ID (numeric) fields are concatenated into the new Top_Students_ID text field.

Note:
This workflow retains the original field data type and treats it as a text field in the Python expression to enable concatenation.
  1. Add a new text field in the attribute table to store the concatenated attributes. Refer to ArcGIS Pro: Fields view for steps to create a new text field.

Note:
The field to store the concatenated attributes must be a text field. Refer to ArcGIS Blog: Concatenating field values using Calculate Field for more information. Using an existing field is possible, but the output of this process overwrites existing data in the field.
  1. In the attribute table, right-click the new field name, and select Calculate Field. In this example, it is Top_Students_ID.
Image showing the Calculate Field option for the target field in the attribute table.
  1. In the Calculate Field geoprocessing pane, type the following expression, and replace Field Name with the name of each field to concatenate.
str(!Field Name!) + " " + str(!Field Name!) + " " + str(!Field Name!)
Note:
The ‘str’ constructor function specifies the field data type to be string. Refer to Python Casting for more information. Remove the double quotation marks (" ") to eliminate the space if required. Do not remove the exclamation marks surrounding the field names.

In this example, the field names are Name, Gender, and Student_ID.

Image showing the field names for truncating.
  1. Click Run. The fields are concatenated and displayed in the new field.
Image showing the fields are concatenated and displayed in the new field.

Artikel-ID: 000023857

Benachrichtigungen erhalten und Lösungen für neue oder häufige Probleme finden

Unser neuer KI-Chatbot stellt zusammengefasste Antworten und Videolösungen für Sie bereit.

Esri Support App herunterladen

Zugehörige Informationen

Weitere Informationen zu diesem Thema erkunden

Unterstützung durch ArcGIS-Experten anfordern

An den technischen Support wenden

Esri Support App herunterladen

Zu Download-Optionen wechseln