Attribute Rule properties

Resumen

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

Attribute rules can be added to a geodatabase feature class or table. The Describe function's dataType property returned is the dataType of the feature class or table.

Propiedades

PropiedadExplicaciónTipo de datos
batch
(Sólo lectura)

Specifies whether the rule is run in batch mode.

  • True—The rule is run in batch mode.
  • False—The rule is not run in batch mode.

Calculation rules can return either true or false, constraint rules will always return false, and validation rules will always return true.

Boolean
checkParameters
(Sólo lectura)

A system-generated JSON value that defines the configuration of a Data Reviewer-based rule.

Learn more about the available ArcGIS Data Reviewer checks

Object
creationTime
(Sólo lectura)

The date and time the attribute rule was created.

DateTime
description
(Sólo lectura)

The description of the attribute rule.

String
errorMessage
(Sólo lectura)

If the attribute rule has a custom error message (that is, constraint rules), this property will return the error message that was assigned for this rule.

String
errorNumber
(Sólo lectura)

If the attribute rule has a custom error number (that is, constraint rules), this property will return the error number that was assigned for this rule.

Long
evaluationOrder
(Sólo lectura)

If the rule type is calculation, this value gives the order in which the rule is run. The evaluation order is based on the order in which 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
(Sólo lectura)

Specifies whether the rule is excluded from client evaluation.

  • True—The rule is excluded from client evaluation (server only).
  • False—The rule is not excluded from client evaluation; it is run for all clients.

Boolean
fieldName
(Sólo lectura)

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

String
id
(Sólo lectura)

Returns the rule ID as an integer value.

Integer
isEnabled
(Sólo lectura)

Specifies whether the rule is enabled.

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

Boolean
name
(Sólo lectura)

The name of the attribute rule.

String
referencesExternalService
(Sólo lectura)

Specifies whether the rule references any external service.

Boolean
requiredGeodatabaseClientVersion
(Sólo lectura)

The required geodatabase client version is set per rule, depending on which ArcGIS Arcade functions are used in the script expression. For example, if the script includes the Sequence operation, a 10.6.1 geodatabase is required.

String
scriptExpression
(Sólo lectura)

The Arcade expression that defines the rule.

Nota:

This property is not available for Data Reviewer rules.

String
severity
(Sólo lectura)

Defines the severity of the error. This property is applicable to validation rule types.

Integer
subtypeCode
(Sólo lectura)

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

Long
tags
(Sólo lectura)

A set of tags that are used to identify the rule.

String
triggeringEvents
(Sólo lectura)

The triggering events defined in the attribute rule. For example, the rule may be triggered by Insert, Update, or Delete events during editing.

String
triggeringFields
(Sólo lectura)

A list of fields that triggers an attribute rule to run when a feature is updated. Triggering fields are only applicable for immediate calculation and constraint rules that have an update triggering event.

Field
type
(Sólo lectura)

The attribute rule type.

  • esriARTCalculation—Calculation attribute rule
  • esriARTConstraint—Constraint attribute rule
  • esriARTValidation—Validation attribute rule

Learn more about the attribute rule types

String
userEditable
(Sólo lectura)

Specifies 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

Muestra de código

Attribute rule properties example

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\\myGDB.USER1.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(f" Name: {ar.name}")
        print(f" Creation time: {ar.creationTime}")
        print(f" Field: {ar.fieldName}")
        print(f" Subtype code: {ar.subtypeCode}")
        print(f" Description: {ar.description}")
        print(f" Is editable: {ar.userEditable}")
        print(f" Is enabled: {ar.isEnabled}")
        print(f" Evaluation order: {ar.evaluationOrder}")
        print(f" Exclude from client evaluation: {ar.excludeFromClientEvaluation}")
        print(f" Triggering events: {ar.triggeringEvents}")
        print(f" Triggering fields: {ar.triggeringfields}\n")
        print(f" Script expression: {ar.scriptExpression}\n")
        print(f" Is flagged as a batch rule: {ar.batch}\n")
        print(f" Severity: {ar.severity}\n")
        print(f" Tags: {ar.tags}\n")
        

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


    elif "Validation" in ar.type:       
        print("- Validation Rule:")
        print(f" Name: {ar.name}")
        print(f" Creation time: {ar.creationTime}")
        print(f" Subtype code: {ar.subtypeCode}")
        print(f" Description: {ar.description}")
        print(f" Is enabled: {ar.isEnabled}")
        print(f" Error number: {ar.errorNumber}")
        print(f" Error message: {ar.errorMessage}")
        print(f" Script expression: {ar.scriptExpression}\n")
        print(f" Is flagged as a batch rule: {ar.batch}\n")
        print(f" Severity: {ar.severity}\n")
        print(f" Tags: {ar.tags}\n")
Data Reviewer attribute rule properties example

The following stand-alone Python script prints a report of the check parameter properties of a Data Reviewer-generated attribute rule.

# Import the required modules
import arcpy

# Path to the input feature class or table
fc = "C:\\MyProject\\MyDatabase.sde\\myGDB.USER1.FacilitySite"

# Print a report of the checkParameter properties
attRules = arcpy.da.Describe(fc)['attributeRules']
for rule in range(len(attRules)):
    for key, value in attRules[rule]['checkParameters'].items():
        print(f"{key}: {value}")