HOW TO

Retain trailing zeros after the decimal point in a label using Arcade in ArcGIS Pro

Last Published: September 6, 2023

Summary

When editing labels with numeric data to two decimal places using the Round() function in an Arcade expression, the trailing zeros after the decimal point are not retained. It is sometimes necessary to retain the zeros after the decimal point in a label to ensure data accuracy and consistency.

In this article, the length of the highways must be rounded to two decimal places; however, the zeros after the decimal point are not displayed. For example, 0.50 is displayed as 0.5, and 1.00 is displayed as 1, as shown in the following image. 

Image of few labels without trailing zeros after the decimal point

The workflow to retain the trailing zeros after a decimal point in labels using the Text() function in an Arcade expression in ArcGIS Pro is provided below.

Procedure

To retain trailing zeros after a decimal point, use the Text() function.

Note: 
Refer to ArcGIS Arcade: Text for more information.
  1. Launch ArcGIS Pro, and open the desired project.
  2. In the Contents pane, click the feature layer.
  3. On the ribbon, click the Labeling tab on the Feature Layer contextual tab set.
The Labeling tab in the Feature Layer contextual tab set
  1. In the Label Class group, click the Field drop-down arrow, and select the field for labeling. Click the Expression icon to display the Label Class – <layer_name> pane.
The Label Class group
  1. In the Label Class – <layer_name> pane, on the Label expression tab, click the Language drop-down arrow, and select Arcade.
The Label Class-<layer_name> pane
  1. In the Expression text box, type the following expression to round off the numeric data to two decimal places, and retain the trailing zeros after the decimal point. Click Verify.
Text($feature.fieldname, '#,###.00')
The expression in the Expression text box
  1. When the message, 'Expression is valid' is returned, click Apply.
The 'Expression is valid' message

The image below shows the trailing zeros are retained in the labels.

The trailing zeros after the decimal point are retained in the labels

Article ID:000024861

Software:
  • ArcGIS Pro 2 x
  • ArcGIS Pro 2 7 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic