Constraint rules specify permissible attribute configurations and general relationships on a feature. Unlike calculation rules, constraint rules are not used to populate attributes; they are used to ensure that specific conditions are met on a feature.
The following video demonstrates how to create a constraint rule.
- This video was created with ArcGIS Pro 3.2.
Constraint rules can be created by clicking the Constraint Rule button in the Add Rules group of the Attribute Rules view. Rules can also be created using the Add Attribute Rule tool or the Import Attribute Rules tool.
Note:
The Ready to Use Rules button provides access to a gallery of configurable checks that support creation of constraint and validation rules. This is available with an ArcGIS Data Reviewer license.
Learn more about how to create attribute rules using ArcGIS Data Reviewer
Constraint rules return a true or false result representing whether a rule is satisfied as follows:
- True—The script expression provided is satisfied and the feature will be created.
- False—The script expression provided is not satisfied and the feature will not be created.
Constraint rules are evaluated at the time of edit operations based on specific triggering events (insert, update, or delete). For update events, you can optionally set a list of triggering fields. If a constraint rule is violated, a user-defined error number and message are returned, and the feature edit is rolled back. The error number and message are specified during the creation of the rule. To find data inconsistencies of existing data, use validation rules.
Learn more about immediate evaluation of attribute rules during editing operations
Examples
The following are examples of how constraint attribute rules can be used in a geodatabase:
- A feature string attribute value must be all uppercase.
- A feature string attribute value must be a specified number of characters.
- For a single-phase overhead transformer with a grounding attribute set to Delta, the following phase values are valid: AB, BC, AC. When grounding is set to Wye, the following phase values are valid: A, B, C.
- A power pole taller than 65 feet can only be made of steel.
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.
To learn more, see Attribute rule script expression examples.