Replace values of a field using an Arcade expression in ArcGIS Online

Last Published: July 21, 2023


In ArcGIS Online, it is possible to replace values of a field using the Replace function in Field Calculator. The Replace function enables users to fix typos, edit or delete values, and rename incorrect or obsolete values for rows of a specific field in an attribute table.

In this example, all Yes values in the Mayor column are replaced with No.

Yes values in the Mayor column


Follow the steps below to replace all values of a field using an Arcade expression in ArcGIS Online.

  1. In ArcGIS Online, click the desired hosted feature layer. On the item details page, click the Data tab.
Data tab in the hosted feature layer
  1. Right-click the field header and select Calculate. In this example, the Mayor field is selected.
Calculator tool for the Mayor column
  1. In the Calculate Field dialog box, click Arcade.
Arcade option in Calculate Field dialog box
  1. In the Arcade Calculator dialog box, click Functions, and type Replace in the box. Click Replace. An Arcade expression is displayed in the Expression field.
Default Arcade expression for Replace function
  1. In the Expression field, modify the Arcade expression as follows:
Replace ($feature.field, ‘initial value’, ‘final value’) 

In this example, the Replace function is used to change all ‘Yes’ values to ‘No’ in the Mayor field using the following expression:

Replace ($feature.Mayor, ‘Yes’, ‘No’)
No values in the Mayor column
  1. Click Test to verify the expression, and click OK to apply the query.
Test and verify the Arcade expression

The image below shows an example of the output in the Mayor field.

Output of Mayor column after the Arcade Replace function
To replace all values in a field in ArcMap, refer to How To: Remove and replace characters from a field in an attribute table.

Article ID:000022951

  • ArcGIS Online

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options