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.
Constraint rules are created in the Attribute Rules view by clicking the Constraint Rule button . Rules can also be created using the Add Attribute Rule tool or the Import Attribute Rules tool. Constraint rules can be created on a dataset in a file or enterprise geodatabase.
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.
To learn more, see Attribute rule script expression examples.
Constraint rules are evaluated immediately during edit operations for specific triggering events (insert, update, and delete) that are specified in the rule properties. 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.
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.
Reference 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 to begin constructing script expressions for attribute rules.