HOW TO

Group and symbolize unique values based on the first or last character of attributes

Last Published: April 25, 2020

Summary

Attributes with unique values are usually alphanumeric characters such as geographic location codes and vehicle registration numbers. These attributes can be grouped based on the first or last digit. Geographic locations can be grouped according to the first digit of the county codes used for data interchange between government agencies. The last digit of vehicle registration numbers can be grouped based on odd and even numbers. This grouping allows the tracking of vehicles on roads where the odd-even road space rationing policy is used, such as Beijing.

Procedure

The following instructions describe how to group and symbolize unique values based on the first or last character of the attributes in ArcGIS Pro and ArcMap.


For ArcGIS Pro
  1. Open the attribute table.
  2. Add a new field and set the field to Text type.
  3. Group the values based on the first or last character of the attributes.
    1. In the attribute table, click the Calculate Field icon.
    2. In the Calculate Field geoprocessing dialog box, set the newly added field as the Field Name.
    3. Type the following expression for the new field.
      • For first character:
        !Field Name![0] , for example !COUNTY![0]

        Expression for first digit
         
      • For last character:
        !Field Name![-1] , for example !VEHIC_NUM![-1]
    4. Click the Verify icon to verify the validity of the expression and click the Run icon to execute the tool.

      Executing tool
       
    5. Open the attribute table to view the new populated field in the attribute table.

      New Field
       
  4. Using Unique Values, set the new field in the Value Field to apply the symbols on the map for the values grouped based on the first or last digit accordingly. For more detailed steps, refer to ArcGIS Pro Web Help: Unique Values.

For ArcMap
  1. Open the attribute table.
  2. Add a new field and set the field to Text type.
  3. Group the values based on the first or last character of the attributes.
    1. In the attribute table, right-click the header of the new field and select Field Calculator.
    2. In the Field Calculator dialog box, select the Python Parser and the String Type option.

      Python Parser and String Type option
       
    3. Type the following expression in the text field and click OK.
      • For first character:
        !Field Name![0] , for example !COUNTY![0]

        Code
         
      • For last character:
        !Field Name![-1] , for example !VEHIC_NUM![-1]
    4. Open the attribute table to view the new field in the attribute table.

      New field
       
  4. Using Unique Values, set the new field in the Value Field to apply the symbols on the map for the values grouped based on the first or last digit accordingly. For more detailed steps, refer to ArcMap Web Help: Using Unique vales to display categories.

Article ID:000017745

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic