Summary
When adding a stand-alone table or dataset with leading zeroes in the 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 the workflow to insert leading zeroes in pop-up field values using an Arcade expression in Map Viewer. In this example, the leading zeroes are added to the SCHOOL_ID field in Portal for ArcGIS Map Viewer.
Procedure
- 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.
- 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.
Text($feature["<fieldName>"], '0000')
- 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 leading zeroes added in the SCHOOLID field pop-up using Arcade.