Summary
In ArcGIS Online and Portal for ArcGIS Map Viewer, it is possible to display numeric field values greater or lesser than a specific value using an Arcade expression. This is useful for better data management and analysis.
In this example, the Plantation feature layer contains three fields named Oats, Barley, and Wheat representing the types of crops in a state. To display the type of the crop in each state with greater than the value of '50000' in the pop-up, an Arcade expression is used.
The image below displays the table of the feature layer with the three fields and their numerical field values.
Procedure
- Open the web map in Map Viewer.
- In the Layers pane, select the layer. In this example, a polygon layer named 'Plantation' is used.
- On the Settings (light) toolbar, click Pop-ups. Ensure pop-ups are enabled by toggling Enable pop-ups on.
- 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.
- In the editor window, configure the expression below.
var <variable_name> = {}
function P(A, B)
{
var C = A
If(Round(C, 2)<symbol><value>)
{
pop_up[B] = C
}
}
P($feature.<field_name1>, "<field_name1>")
P($feature.<field_name2>, "<field_name2>")
P($feature.<field_name3>, "<field_name3>")
return <variable_name>
- Replace <variable_name> with the desired variable name. In this example, 'pop_up' is used.
- Replace <symbol> with the greater or lesser than symbol. In this example, the greater than (>) symbol is used.
- Replace <value> with the specific value to be measured as greater or lesser than the fields to be displayed. In this example, the value 50000 is specified to display fields greater than 50000.
- Replace <field_name1>, <field_name2>, and <field_name3> with the names of the fields containing the numeric field values. In this example, the field names are Oats, Barley, and Wheat.
- Click Done.
Note:
Click OK in Portal for ArcGIS Map Viewer.
- In the Pop-ups pane, click Fields list and click Select fields.
- In the Select fields pane, under Expressions, click the expression created in Step 5 to display in the pop-up.
The Map Viewer pop-up below displays the fields with values greater than 50000.