Skip To Content

Constraint attribute rules

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 Constraint Rules. 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.

Examples

The following are examples of constraint attribute rules:

  • A feature string attribute value must be all uppercase.
  • A feature string attribute value must be a specified number of characters in length.
  • 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.

    This is an example of a constraint attribute rule where a power pole taller than 65 feet must be made of steel.

    if ($feature.structureheight >= 65)
    {
        If (DomainName($feature, 'Material') == 'Steel')
        { return true; }
        else
        { return false; }
    }
    Else
    {  return true; }

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

See specific examples of attribute rule script expressions


In this topic
  1. Examples