Instrução

Reter os zeros à direita após o ponto decimal em um rótulo usando o Arcade no ArcGIS Pro

Last Published: September 6, 2023

Resumo

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.

Procedimento

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 do Artigo: 000024861

Receba notificações e encontre soluções para problemas novos ou comuns

Obtenha respostas resumidas e soluções de vídeo do nosso novo chatbot de IA.

Baixe o Aplicativo de Suporte da Esri

Informações Relacionadas

Descubra mais sobre este tema

Obtenha ajuda de especialistas do ArcGIS

Entre em contato com Suporte Técnico

Baixe o Aplicativo de Suporte da Esri

Ir para as opções de download