Summary
When configuring pop-ups in ArcGIS Online, custom expressions written in the Arcade expression language are available. Expressions can be used to create and display new information from existing fields in the layer.
This article provides the steps to round a numeric value to a set number of decimal places for string fields in a pop-up via ArcGIS Online Map Viewer.
Procedure
- Open the map in Map Viewer. Click Layers, and select the <layer name> with the pop-up for editing.
- Click Configure pop-ups > Manage expressions.
- Click + Add expression to open the Arcade Expression dialog box.
- The sample Arcade expression below describes the functions specified to round the number values in the Notes field.
- The var str variable is used to allow multiple functions in one Arcade expression.
- The Mid text function returns a specified number of characters from the middle of a text value.
- The Round mathematical function rounds the number values to the given number of decimal places.
- The Left text function returns a specified number of characters from the beginning of a text value.
- The Right text function returns a specified number of characters from the end of a text value.
var str=Mid($feature.Notes, 21, 7)
var str1=Round(str, 2)
Left($feature.Notes, 21)+str1+Right($feature.Notes, 2)
- Rename the Custom field name to Notes. Click OK.
- Click the Previous button above the newly created Arcade expression in the Pop-up expressions pane.
- Click Fields list to expand the list of fields displayed in the pop-ups, and click Select fields.
- Uncheck the Notes field without the Arcade expression, and check the Notes field with the Arcade expression. Click Done.
The image below demonstrates the pop-up display of the standard Notes field.
The image below demonstrates the pop-up display of the Notes field with the Arcade expression.