Skip To Content

Introduction to attribute rules

Attribute rules enhance the editing experience and improve data integrity for geodatabase datasets. They are user-defined rules that can be used to automatically populate attributes, restrict invalid edits during edit operations, and perform quality assurance checks on existing features.

Attribute rules are complementary to existing rules used in the geodatabase, such as domains and subtypes. For example, domains can be assigned to an attribute field to aid in the data collection process by providing a pick list of valid values for editors. Additionally, an attribute rule can be used to restrict values for an attribute field that are not part of the domain when performing a field calculation. After rules are added to a dataset, they can be evaluated as edits take place or at a later time.

The following are examples of how attribute rules can be used in a geodatabase:

  • To save time during editing, specific attribute values are automatically populated for newly created features. For example, when a new pole is created, the assetID attribute is generated based on a sequence.
  • To help enforce data integrity, edits can be blocked based on a user requirement. For example, when creating or updating a single phase transformer, the phasescurrent attribute must be A, B, or C.
  • Populate specific attribute values for existing features at a user-specified time. For example, the fulladdress field for existing features is populated by concatenating several text fields.
  • Check existing features to ensure user requirements are maintained after field edits are made. For example, existing features can be evaluated to ensure that when a pole is taller than 65 feet, the material must be steel. Features that don't pass the evaluation are flagged as error features to be reviewed.

Rule type

When you create an attribute rule, you must specify the rule type to use. The attribute rule type chosen depends on the desired task and at what point in the editing process the rule needs to be evaluated. Review the following rule type details to determine the applicable rule type for your workflow:

  • Calculation—To increase efficiency in data collection and editing, calculation rules automatically populate attributes based on editing pattens. This enhances the editing experience as new features are created or as changes are made to existing features. Rules can also be evaluated at a user-specified time on all features in a dataset.
  • Constraint—To ensure quality data is entered into the GIS, constraint rules control data entry by user-defined requirements. This prevents invalid data entry during edit operations to ensure data integrity.
  • Validation—To review features that violate specified attribute or geometry requirements, validation rules highlight errors in existing data. This brings awareness to affected features to improve data integrity.

To learn more about each rule type, see Calculation attribute rules, Constraint attribute rules, and Validation attribute rules.

Attribute Rules view

Attribute rules are viewed, created, and managed in their own tabular-style view. The Attribute Rules view can be accessed using the context menu of the dataset directly from the Catalog or Contents pane. It can also be accessed by clicking the Attribute Rules button on the ribbon; this is available in the Design group on the Data tab when an active layer in the map view is selected or when using the Fields or Subtypes view.

For more details about using this view, see Attribute Rules view.

Create attribute rules

Attribute rules are created for an input feature class or table as the data owner. Rules can be created in the Attribute Rules view using the Add Attribute Rule tool, or imported using the Import Attribute Rules tool. Rules can be targeted for specific subtypes in the rule definition. This is helpful when you want a rule to only apply to a subset of features in a dataset.

Arcade script expressions are used as part of the rule definition to define what to calculate or the valid feature configurations. Arcade is a portable expression language that can be used across the ArcGIS platform.

The Arcade Getting Started guide and Function Index can be used as references when constructing script expressions for attribute rules.

Caution:
Adding attribute rules impacts backward compatibility for the dataset.
  • Datasets with attribute rules can no longer be used by ArcGIS Pro releases prior to 2.1 or ArcMap clients.
  • Datasets with attribute rules that use new Arcade functionality are not backward compatible. Reference the ArcGIS Arcade Version matrix and Release notes for more information.

Manage attribute rules

Once attribute rules are established on datasets in the geodatabase, there are several ways to review and manage the rules. The Attribute Rules view can be used to display properties, make changes to existing attribute rules, and create rules. Geoprocessing tools in the Attribute Rules toolset are also available to administer attribute rules for a dataset or to script certain tasks.

The arcpy.Describe function can be used on a dataset to print the attribute rule properties. You can also view attribute rule properties using the Export Attribute Rules tool and reviewing the contents of the exported CSV file.

Attribute rules can be temporarily disabled on a dataset using the Attribute rules view or the Disable Attribute Rule and Enable Attribute Rule tools. When in a disabled state, the specific rule will not execute for triggering events. This can improve performance for bulk data loads and is useful for periods where rule execution must be suspended.

Attribute rules are created as a property of feature classes or tables in the geodatabase. Attribute rules can be transferred between datasets in the geodatabase using the Export Attribute Rules and Import Attribute Rules tools. These tools use a CSV file to store the definition of the attribute rule. Data migration methods such as Copy and Paste, Feature Class To Feature Class, and Table To Table will not transfer the attribute rules with the underlying dataset.

See the Manage attribute rules section of the Attribute Rules view topic to learn more.

Share datasets with attribute rules

Datasets that have attribute rules can be published via map and feature services. When sharing and working with web feature layers that contain attribute rules, there are a few things to keep in mind. Depending on the rule type and properties, the rule evaluation will occur at different times. Also, there are special requirements when publishing if the dataset contains attribute rules that depend on the validation server to evaluate the rules.

To learn more, see Share datasets with attribute rules.