HOW TO

Display field names in pop-ups based on field values using Arcade in ArcGIS Online and Portal for ArcGIS

Last Published: August 18, 2023

Summary

In ArcGIS Online or Portal for ArcGIS, when the same field value is present in multiple fields, a conditional Arcade expression can be used to display the field names in pop-ups. This method is useful when intending to display precise pop-up results.

In this article, the feature layer contains five fields named, Corn, Oats, Barley, Wheat, and Soybeans. The workflow provided displays the field names in the pop-ups when the feature contains the ‘Yes’ field value for the five fields in ArcGIS Online or Portal for ArcGIS Map Viewer.

The table below displays the five fields and its field values to be displayed in the pop-ups.

Table containing field names to be displayed in pop-ups

Procedure

  1. Open the web map in Map Viewer.
  2. In the Layers pane, select the layer. In this example, a polygon layer named ‘Plantation’ is used.
  3. On the Settings (light) toolbar, click Pop-ups. Ensure pop-ups are enabled by toggling the Enable pop-ups option on.
  4. In the Pop-ups pane, create an Arcade expression to display the field names in the pop-ups. Refer to ArcGIS Online: Use expressions or Portal for ArcGIS: Use expressions for instructions.
  5. In the editor window, configure the expression below.
Expects($feature, "<field_name1>", "<field_name2>", "<field_name3>", "<field_name4>", "<field_name5>")
var <variable_name> = []
for(var field in $feature) {
  if($feature[field] == "<field_value>"){
     Push(<variable_name>, field)
  }
}
return Concatenate(<variable_name>, ", ")
  1. Replace <field_name1>, <field_name2>, <field_name3>, <field_name4>, and <field_name5> with the name of the fields containing the field values. In this example, the field names are Corn, Oats, Barley, Wheat, and Soybeans.
  2. Replace <variable_name> and <field_value> with the desired attribute value. In this example, ‘Yes’ is used.
  1. Click Done.
Note:
Click OK in Portal for ArcGIS Map Viewer.
Editor window with Arcade expression
  1. In the Pop-ups pane, click Fields list and click Select fields.
  2. In the Select fields pane, under Expressions, click the expression to display in the pop-up.

The Map Viewer pop-up below displays the field names with the ‘Yes’ field values.

Web map displaying field names in a pop-up when a feature is selected in Map Viewer.

Article ID: 000029827

Software:
  • ArcGIS Online
  • Portal for ArcGIS

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