操作方法

操作方法:在 ArcGIS Pro 中使用 Arcade 保留标注中小数点后的零

Last Published: September 6, 2023

摘要

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.

过程

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

接收通知并查找新问题或常见问题的解决方案

从我们全新的 AI 聊天机器人中获得简明答案和视频解决方案。

下载 Esri 支持应用程序

相关信息

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项