PROBLEM

Filter in Map Viewer does not currently support attribute expressions as fields

Last Published: February 13, 2025

Description

In ArcGIS Online, users may encounter a limitation where the filter functionality does not support the use of attribute expressions directly as fields

Suppose you have a map displaying data for counties in a region, with a layer showing population data for 2011 and 2021. You aim to filter the counties to only show those that have experienced a negative population change (decrease) during this period. However, you cannot achieve this using the Filter tool directly because it does not support creating interactive expressions for the filter criteria.

Cause

This is by design, the Filter tool in ArcGIS Map Viewer only supports filtering based on actual attribute fields in the dataset. 

Solution or Workaround

To work around this limitation, you can write an expression in the Styles pane in Map Viewer, in the Choose attributes section. 

Here’s a step-by-step guide using the previous example: 

  1. Open the map in Map Viewer.
  2. Click Layers on the Contents (dark) toolbar, and select the layer to work with.
  3. On the Settings (light) toolbar click Styles
  4. In the Styles pane, navigate to the Expression box to add a custom Arcade expression.
  5. Adjust the visual settings by picking a style based on the selected field.   
  6. Click Done.

The following expression is used to show only those features where the calculated percentage change in population is negative. 

var procent = ($feature.population-2021-$feature.population-2011)*100/$feature.population-2011; 
if (procent < 0) {return procent} 

The layer now contains only the geometries returned by the expression, symbolized in red in the example shown below. To display the counties with an increase in population in blue (the geometries that were not returned in the first result), a copy of the layer was created and another expression was used for Styles

Article ID: 000033868

Software:
  • ArcGIS Online

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