CÓMO

Conservar los ceros finales después del punto decimal de una etiqueta con Arcade en ArcGIS Pro

Last Published: September 6, 2023

Resumen

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.

Procedimiento

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

Id. de artículo: 000024861

Recibir notificaciones y encontrar soluciones a problemas nuevos o comunes

Obtenga respuestas resumidas y soluciones de vídeo de nuestro nuevo chatbot de IA.

Descargar la aplicación de soporte de Esri

Información relacionada

Descubrir más sobre este tema

Obtener ayuda de expertos en ArcGIS

Contactar con el soporte técnico

Descargar la aplicación de soporte de Esri

Ir a opciones de descarga