HOW TO

Beibehalten von nachgestellten Nullen nach dem Dezimaltrennzeichen in einer Beschriftung mithilfe von Arcade in ArcGIS Pro

Last Published: September 6, 2023

Zusammenfassung

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.

Vorgehensweise

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.
Image of 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.
Image of 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.
Image of 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')
Image of the expression in the Expression text box
  1. When the message, 'Expression is valid' is returned, click Apply.
Image of 'Expression is valid'message

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

Image of the trailing zeros after the decimal point are retained in the labels

Artikel-ID:000024861

Hilfe von ArcGIS-Expert*innen erhalten

Technischen Support kontaktieren

Die Esri Support-App herunterladen

Zu den Download-Optionen

Zugehörige Informationen

Weitere Informationen zu diesem Thema erkunden