English
Continue in the app
Be The First To Get Support Updates
Want to know about the latest technical content and software updates?

How To: Insert leading zeroes in pop-up field values in Map Viewer

Summary

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.

The attribute table and pop-up of the layer in Portal for ArcGIS 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.

Procedure

  1. 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.
The Map Viewer Contents (dark) toolbar with the Layers tab
  1. Click Configure pop-ups on the Settings (light) toolbar, and click Options > Manage expressions.
The Map Viewer Settings (light) toolbar and the Pop-ups pane
  1. Click + Add expression to open the Arcade expression editor window.
  2. In the editor window, specify a name for the new expression as required.
  3. 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')
  1. Click Test to view a preview of the expression result. If the required result is achieved, click OK.
Specifying the Arcade expression in the Portal for ArcGIS Map Viewer editor window
  1. Click the Previous button above the Arcade expression in the Pop-up expressions pane.
The Portal for ArcGIS Map Viewer Pop-up expressions pane with the Previous icon above the newly created expression
  1. Click Fields list to expand the list of fields displayed in the pop-ups, and click Select fields.
  2. 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.

The pop-up displaying leading zeroes in the field value in Portal for ArcGIS Map Viewer

Related Information

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