HOW TO

Identify a duplicate field value using an attribute rule when editing the attribute table in ArcGIS Pro

Last Published: January 10, 2023

Summary

In ArcGIS Pro, the attribute table may contain both unique and common values. Sometimes only unique values are allowed in a column to ensure there is no duplicate value for a particular field, such as employee IDs.

In this article, an attribute rule is used to populate the term 'Duplicate' when a field is populated with the same value as another record. This method is useful in ensuring no duplicate records are created in the attribute table.

Procedure

Note:
The attribute rule to identify duplicate field values in the attribute table only works for a text field.
  1. Open the ArcGIS Pro project.
  2. In the Catalog pane, browse to and right-click the feature class, and click Manage.
  3. In the Feature Class Properties window, in the Manage section, check the Global IDs check box, and click OK.
Global IDs enabled for the feature class.
Note:
The dataset requires Global IDs to add an attribute rule.
  1. Right-click the feature layer in the Contents pane and click Data Design > Attribute Rules.
  2. Click the Add Rule drop-down list and select Add Immediate Calculation Rule.
  3. Specify Rule Name. In this example, Test Rule is used.
  4. For Field, select the field to use. In this example, EmployeeID is used.
  5. Insert and configure the expression below in the Expression box.
var features = FeatureSetByName($datastore,'<feature_class>', ['<field_name>'], false);

for(var i in features)
  if((i.<field_name> == $feature.<field_name>) && (i.OBJECTID != $feature.OBJECTID)) {
     return "Duplicate";}
return $feature.<field_name>;
  1. Replace <feature_class> with the name of the feature class containing the field to check for duplicate values. In this example, Workforce is used.
  2. Replace <field_name> with the name of the field in the attribute table to check for duplicate values. In this example, EmployeeID is used.
  1. Under Triggers, check the desired option. In this example, Insert and Update are checked.
Attribute rule to identify duplicate field values.
  1. On the Attribute Rules tab, in the Attribute Rules group, click Save.

The image below demonstrates the term Duplicate is populated when a record with the duplicate employee ID is created in the attribute table.

Attribute rule populated by the term 'Duplicate'

Article ID: 000029088

Software:
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 7 x
  • ArcGIS Pro 2 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options
Esri Support AI Chatbot