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 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 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.
  • Review existing features to ensure that 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 types

When you create an attribute rule, you must specify the rule type to use. The attribute rule type chosen depends on the 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, immediate calculation rules automatically populate attributes based on editing patterns. This enhances the editing experience as new features are created or as changes are made to existing data. Batch calculation rules are evaluated at a user-specified time on existing data.
  • Constraint—To ensure quality data is entered into the GIS, constraint rules control data entry by user-defined requirements. This prevents invalid data entry while editing to ensure data integrity. To find data inconsistencies of existing data, use validation rules.
  • 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.

Attribute Rules view

Attribute rules are viewed, created, and managed in their own tabular-style view called the Attribute Rules 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 in the Data Design group on the Data tab for a feature layer or Standalone Table tab for a table when an active layer in the map view is selected or when using the Fields or Subtypes view.

For details about using this view, see Create and manage attribute rules.

Create attribute rules with Arcade

Attribute rules are created on an input feature class or table. To add an attribute rule, the dataset must have GlobalIDs, and for enterprise geodatabases, the operation must be performed as the data owner. Additionally, editor tracking must be enabled for batch calculation or validation rules You can create rules in the Attribute Rules view using the Add Attribute Rule tool or 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.

ArcGIS 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.

See the Arcade profile for the requirements and global variables to author attribute rule types. The Arcade Getting Started guide and Function Index are additional resources you can use to construct script expressions for attribute rules.

Learn more about authoring attribute rule script expressions

Create attribute rules with Data Reviewer

Optionally, attribute rules are created using capabilities available in ArcGIS Data Reviewer. Data Reviewer provides a library of data validation checks that identify common errors found in spatial data. These checks assess different aspects of a feature's quality that can include its attribution, integrity, or spatial relationship to other features.

Data Reviewer checks are configurable and enable you to implement organization-specific data quality requirements without the requirement to create or maintain custom code.

Learn more about managing attribute rules using Data Reviewer

Note:
Adding attribute rules to a dataset impacts backward compatibility:
  • Once attribute rules are added to a dataset, it is incompatible with ArcMap or ArcGIS AllSource 2.0 and earlier. See Client and geodatabase compatibility for more information on functionality available when using mixed client and geodatabase releases.
  • Newer Arcade functions impact what ArcGIS client releases can access the dataset with the attribute rule. See Compatibility of Arcade in script expressions 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. You can use the Attribute Rules view to display properties, make changes to existing attribute rules, and create rules. You can also use geoprocessing tools in the Attribute Rules toolset to administer attribute rules for a dataset or to script certain tasks.

To learn more, see Manage attribute rules.

Evaluate attribute rules and manage error features

You can evaluate attribute rules for a dataset during an edit operation or at a user-specified time on existing data. Depending on the rule type and properties, the attribute rule evaluation will occur at different times:

  • Immediate evaluation
    • Immediate calculation rules
    • Constraint rules
  • Deferred evaluation
    • Batch calculation rules
    • Validation rules

Learn more about the evaluation of attribute rules

Evaluation of batch calculation and validation rules creates errors to highlight data that violates attribute rules. Each error is stored as an error feature in the error layers. Error features can be reviewed through the Error Inspector during quality assurance workflows.

Learn more about managing attribute rule errors