HOW TO

Insert leading zeroes in pop-up field values in Map Viewer

Last Published: July 18, 2023

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.

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

  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.
  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 leading zeroes added in the SCHOOLID field pop-up using Arcade.

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

Article ID:000028305

Software:
  • ArcGIS Online
  • Portal for ArcGIS

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic