How To: Insert leading zeroes in pop-up field values in Map Viewer
When adding a standalone table or dataset with leading zeroes in a field to ArcGIS Online or Portal for ArcGIS, the zeroes are omitted from the attribute table or pop-up in Map Viewer. The image below shows the SCHOOL_ID field without any leading zeroes in Map Viewer.
This article provides a workflow to insert leading zeroes in pop-up field values using an Arcade expression in Map Viewer. In this example, leading zeroes are added to the SCHOOL_ID field in Portal for ArcGIS Map Viewer.
- In Map Viewer, click Layers on the Contents (dark) toolbar, and select the layer with the pop-up for editing. In this example, the Schools_all layer is selected.
- Click Configure pop-ups on the Settings (light) toolbar, and click Options > Manage expressions.
- Click + Add expression to open the Arcade expression editor window.
- In the editor window, specify a name for the new expression as required.
- In the Expression dialog box, insert the following Arcade expression. Insert the number of zeroes according to the number of digits. In this example, the expression is used to add leading zeroes for four digits.
- Click Test to view a preview of the expression result. If the required result is achieved, click OK.
- Click the Previous button above the 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.
- Check the expression field under the Expressions section, and click Done.
The image below shows the newly added leading zeroes in the SCHOOLID field in the pop-up after using the Arcade expression.
- ArcGIS Online: View pop-ups (Map Viewer)
- Portal for ArcGIS: View pop-ups (Map Viewer)
- Portal for ArcGIS: Use expressions
- How To: Convert the field type in ArcGIS Online
Last Published: 9/20/2022
Article ID: 000028305
Software: Portal for ArcGIS 10.9.1, 10.9, 10.8.1, 10.8 ArcGIS Online Current