Attribute Rule properties

サマリー

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.

プロパティ

プロパティ説明データ タイプ
batch
(読み取り専用)

Indicates whether the rule is executed in batch mode.

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

Calculation rules may return either true or false, but constraint rules will always return false, and validation rules will always be true.

Boolean
checkParameters
(読み取り専用)

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
(読み取り専用)

The date and time the attribute rule was created.

DateTime
description
(読み取り専用)

The description of the attribute rule.

String
errorMessage
(読み取り専用)

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
(読み取り専用)

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
(読み取り専用)

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
(読み取り専用)

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

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

Boolean
fieldName
(読み取り専用)

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

String
id
(読み取り専用)

Returns the rule ID as an integer value.

Integer
isEnabled
(読み取り専用)

Returns a Boolean describing 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
(読み取り専用)

The name of the attribute rule.

String
referencesExternalService
(読み取り専用)

Indicates whether the rule references any external service.

Boolean
requiredGeodatabaseClientVersion
(読み取り専用)

The required geodatabase client version is set per rule, depending on which 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
(読み取り専用)

The Arcade expression that defines the rule.

注意:

This property is not available for Data Reviewer rules.

String
severity
(読み取り専用)

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

Integer
subtypeCode
(読み取り専用)

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

Long
tags
(読み取り専用)

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

String
triggeringEvents
(読み取り専用)

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
(読み取り専用)

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

String
userEditable
(読み取り専用)

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

コードのサンプル

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\\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(" Name: {0}".format(ar.name))
        print(" Creation time: {0}".format(ar.creationTime))
        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))
        print(" Is flagged as a batch rule: {0} \n".format(ar.batch))
        print(" Severity: {0} \n".format(ar.severity))
        print(" Tags: {0} \n".format(ar.tags))

    elif "Constraint" in ar.type:       
        print("- Constraint Rule:")
        print(" Name: {0}".format(ar.name))
        print(" Creation time: {0}".format(ar.creationTime))
        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))
        print(" Tags: {0} \n".format(ar.tags))

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

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("{}: {}".format(key, value))