English

How To: Populate a new field with trend status using Arcade expressions in ArcGIS Online

Summary

ArcGIS Online uses Arcade expressions to make working with GIS data flexible by allowing users to derive a new value based on existing values in the feature layer. For example, to determine the trend status of the population growth in cities, the total sales of a business, or the number of crimes that have occurred in two given years.

Procedure

The following instructions describe how to populate a new field with trend status using Arcade expressions in ArcGIS Online. In this article, the new field is populated with the trend status of population growth between the years 2000 and 2007.

  1. Navigate to Content > My Content, and open the item details page of the hosted feature layer.
  2. Click the Data tab. Click the Options icon and select Add Field.
User-added image
Note: 
The table view can also be accessed from Map Viewer. Click Overview > Open in Map Viewer on the item description page. In Map Viewer, click Content. Hover over the feature layer and click Show Table.
  1. Fill in the Field Name and Display Name in the Add Field dialog box. Select String as theType of output from the drop-down list. Click Add New Field.
Image of the Add Field dialogue box 
  1. Click the new field and select Calculate.
  1. Select the Arcade option to perform the calculation in the Calculate Field dialog box.
Image of the Calculate Field dialogue box
  1. Fill in the expression in the Arcade Calculator dialog box. The following expression compares the values of the fields POP2000 and POP2007. If the value in POP2007 is larger than POP2000, a 'Positive' value is returned in the new field. Otherwise, a 'Negative' value is returned.
if ($feature.POP2007 >= $feature.POP2000) {"Positive"} else {"Negative"}
  1. Click Test to verify the expression, and click OK to apply the query in Arcade.
Click Test to verify the expression

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

Example output

Related Information