Skip To Content

Attribute Rule properties

Summary

The Describe function returns the following properties for datasets that have attribute rules added to them.

Attribute rules can be added to a geodatabase feature class or table. The dataType returned is the dataType of the feature class or table.

Properties

PropertyExplanationData Type
description
(Read Only)

The description of the attribute rule.

String
errorMessage
(Read Only)

If the attribute rule supports custom errors (ie. constraint rules), this property will return the error message that was assigned for this rule.

String
errorNumber
(Read Only)

If the attribute rule supports custom errors (ie. constraint rules), this property will return the error number that was assigned for this rule.

Long
evaluationOrder
(Read Only)

If the rule type is calculation, this value gives the order that the rule is executed. The evaluation order is based on the order that the rule was added to the dataset. For example, if Rule A is added before Rule B, the evaluation number will be lower for Rule A.

Long
excludeFromClientEvaluation
(Read Only)

Returns a Boolean describing whether the rule is excluded from client evaluation.

  • True— The rule is excluded from client evaluation.
  • False—The rule is executed for all clients.

Boolean
fieldName
(Read Only)

If the attribute rule is assigned to a field (ie. a calculation rule type), this property returns the field name.

String
isEnabled
(Read Only)

Returns a Boolean describing whether the rule is enabled or not.

  • True—The rule is enabled and will be honored during editing operations.
  • False—The rule is disabled and will not be honored during editing operations.

Boolean
name
(Read Only)

The name of the attribute rule.

String
scriptExpression
(Read Only)

The Arcade expression that defines the rule.

String
subtypeCode
(Read Only)

If the attribute rule is assigned to a subtype, this property returns the subtype code for which it is assigned.

Long
triggeringEvents
(Read Only)

The triggering events defined in the attribute rule. For example, the rule may be triggered by insert, update, or delete events during editing.

String
type
(Read Only)

The type of the attribute rule. For example, a rule may be a calculation or constraint rule type.

String
userEditable
(Read Only)

Returns a Boolean describing whether the rule allows editing of the attribute field that is being modified by the rule.

  • True— Editors can edit the attribute values.
  • False—Editors cannot edit the attribute values.

Boolean

Code sample

Attribute Rule properties example (stand-alone script)

The following stand-alone Python script prints a report of the attribute rule properties for a feature class.

# Import the required modules
import arcpy

# Path to the input feature class or table
fc = "C:\\MyProject\\MyDatabase.sde\\pro21.GDB.Building"

# Print a report of the attribute rule properties
attRules = arcpy.Describe(fc).attributeRules
print("- Attribute Rule Properties -")

for ar in attRules:    
    if "Calculation" in ar.type:       
        print("- Calculation Rule:")
        print(" Name: {0}".format(ar.name))
        print(" Field: {0}".format(ar.fieldName))
        print(" Subtype code: {0}".format(ar.subtypeCode))
        print(" Description: {0}".format(ar.description))
        print(" Is editable: {0}".format(ar.userEditable))
        print(" Is enabled: {0}".format(ar.isEnabled))
        print(" Evaluation order: {0}".format(ar.evaluationOrder))
        print(" Exclude from client evaluation: {0}".format(ar.excludeFromClientEvaluation))
        print(" Triggering events: {0}".format(ar.triggeringEvents))
        print(" Script expression: {0} \n".format(ar.scriptExpression))

    elif "Constraint" in ar.type:       
        print("- Constraint Rule:")
        print(" Name: {0}".format(ar.name))
        print(" Subtype code: {0}".format(ar.subtypeCode))
        print(" Description: {0}".format(ar.description))
        print(" Is editable: {0}".format(ar.userEditable))
        print(" Is enabled: {0}".format(ar.isEnabled))
        print(" Error number: {0}".format(ar.errorNumber))
        print(" Error message: {0}".format(ar.errorMessage))
        print(" Exclude from client evaluation: {0}".format(ar.excludeFromClientEvaluation))
        print(" Triggering events: {0}".format(ar.triggeringEvents))
        print(" Script expression: {0} \n".format(ar.scriptExpression))