Evaluate attribute rules

After adding attribute rules to the data, the evaluation process reviews the rules on the data to ensure rules are followed. The evaluation method used depends on the rule type and properties. Immediate evaluation rules are evaluated immediately during an edit operation, while deferred evaluation rules are evaluated at a specified time as follows:

  • Immediate evaluation
    • Immediate calculation rules
    • Constraint rules
  • Deferred evaluation
    • Batch calculation rules
    • Validation rules
License:
To evaluate validation and batch calculation attribute rules for web feature layers, organization members must be assigned a license for the ArcGIS Advanced Editing user type extension (ArcGIS Enterprise 11.2 or later).

Immediate evaluation during editing

Immediate calculation and constraint rules are evaluated during an edit operation. Evaluation is controlled by the type of editing triggering event (insert, update, or delete). For update events, you can optionally specify a list of triggering fields. The editing triggering event and triggering fields are defined in the rule properties. To review the rule properties, see Create and manage attribute rules.

When you edit data in ArcGIS AllSource or through a feature service, these rules are evaluated. Calculation rules either automatically populate fields or return an error message when the calculation expression fails. Constraint rules return an error message for rule violations. As edits are made, immediate calculation rules are evaluated first, followed by constraint rules. Any default values are set on features before evaluating these rules.

The following video shows an example of an immediate calculation rule triggering while making edits.

Play Video

  • This video was created with ArcGIS Pro 3.2.

The following video shows an example of a constraint rule triggering while making edits.

Play Video

  • This video was created with ArcGIS Pro 3.2.

Exclude from application evaluation

Immediate calculation and constraint rules have an Exclude from application evaluation option in the rule properties that affects evaluation during editing. When the Exclude from application evaluation option is disabled, the rule will evaluate locally before the apply edit request is sent to the data source, which is ArcGIS Enterprise when editing a feature service or the geodatabase when directly editing the feature class or table. ArcGIS AllSource is the only application that is capable of evaluating rules locally.

If you don't want a rule to be evaluated until all your edits are made and not as each edit is made, enable this option to avoid ArcGIS AllSource from evaluating rules locally.

Note:
The Exclude from application evaluation option must be true for immediate calculation rules if the Arcade expression returns specific attribute rule dictionary keywords, uses sequences, or when the field value is used in the calculation.

Deferred evaluation

Batch calculation and validation rules are evaluated at a user-specified time using the Error Inspector view or the Evaluate Rules tool. During evaluation, a batch calculation rule will automatically populate fields or create error features when calculation expressions fail, and a validation rule will create error features that highlight features violating rules. If both rule types are evaluated simultaneously, the batch calculation rules are evaluated first, followed by the validation rules. Error features for these rules can be reviewed through the Error Inspector view.

The following video shows an example of a validation rule triggering when Evaluate Rules is run from the Error Inspector view.

Play Video

  • This video was created with ArcGIS Pro 3.2.
Note:
The input workspace for evaluating batch calculation and validation rules depends on the type of geodatabase the dataset with attribute rules is stored in:
  • File or mobile geodatabases—A geodatabase is the input workspace to evaluate.
  • Enterprise geodatabases—A feature service with the Validation capability is the input workspace to evaluate. If the same dataset is published to multiple services, be aware that the error layers and validation status attribute are shared for the default version.

Validation Status attribute

The evaluation of batch calculation and validation rules is tracked by the Validation Status field in the dataset. The Validation Status field is added when the first batch calculation or validation rule is created for the dataset.

The field reports the following information for each feature:

  • Does the feature require calculation?
  • Does the feature require validation?
  • Does the feature have errors?

The validation status for a feature must be set to calculation required or validation required for the evaluation to review the rules on the feature.

The Validation Status field is updated when the feature is edited and during evaluation. When a batch calculation or validation rule is added or modified for a dataset, the validation status attribute values are reset for all rows. (This applies to all versions for enterprise geodatabases.) When a dataset is migrated to another location, the validation status attribute is reset for the output dataset that is created.

See the following examples:

  • When adding only validation rules to a dataset, the validation status is updated to 2: No calculation required, validation required, no error.
  • When adding only batch calculation rules to a dataset, the validation status is updated to 4: Calculation required, no validation required, no error.
  • When adding a batch calculation and validation rule to a dataset, the validation status is updated to 6: Calculation required, validation required, no error.

CodeDescription

0

No calculation required, no validation required, no error

1

No calculation required, no validation required, has error(s)

2

No calculation required, validation required, no error

3

No calculation required, validation required, has error(s)

4

Calculation required, no validation required, no error

5

Calculation required, no validation required, has error(s)

6

Calculation required, validation required, no error

7

Calculation required, validation required, has error(s)

Validation Status coded value domain

Error layers

To evaluate batch calculation and validation rules with the Error Inspector, you must add the attribute rule error layers to the map. Use the layer's context menu Add Error Layers option to add a group layer of the error datasets from the geodatabase or feature service.

The error layers group layer is composed of the following datasets:

  • GDB_ValidationPointErrors
  • GDB_ValidationLineErrors
  • GDB_ValidationPolygonErrors
  • GDB_ValidationObjectErrors

The Add Error Layers option is available after creating these rules in the geodatabase or sharing the four error datasets as part of a web feature layer that has Validation capabilities enabled. The error layers group layer is used as the source in the Error Inspector to evaluate rules and review error features.

The error datasets are created when the first batch calculation or validation rule is created in a geodatabase. These are used to store all errors created during rule evaluation.

Note:
The error datasets that store the spatial errors are created with the WGS84 spatial reference.

Evaluate rules using the Error Inspector

You can evaluate batch calculation and validation rules using the Error Inspector in ArcGIS AllSource. The source for the Error Inspector must be the error layers from a geodatabase or a feature service with the Validation capability.

    To evaluate rules using the Error Inspector, complete the following steps:
  1. On the Insert tab, in the Project group, click New Map New Map.
  2. On the Map tab, in the Layer group, click Add Data. Browse to the data source and select the feature classes or tables to evaluate. Click OK.
    • For data shared as a feature service with the Validation capability, the data source is under Portal Portal.
    • For data in a geodatabase, the data source is under Project or Computer.
  3. In the Contents pane, right-click the layer, and click Add Error Layers Group layer.

    The associated error layers are added as a single group layer, which will be used to evaluate rules in the Error Inspector.

  4. On the Edit tab, in the Manage Edits group, click Error Inspector Error Inspector.

    On the Error Inspector toolbar, the Source option references the error layers in the map view.

    The Source option references the error layers in the map view.
  5. Optionally, click the Source drop-down button and choose the error layer to change the value.
  6. On the Evaluate Rules button Validate Extent, click the drop-down arrow Drop-down button to expand the options for evaluating rules.
    1. For Rule Type, choose at least one to evaluate.

      • Batch Calculation Rules
      • Validation Rules

    2. For Extent, choose one of the options:

      • Visible extent—Evaluate the visible extent of the map.
      • Full extent—If the source is a feature service, evaluate the full extent of the feature service. If the source is a geodatabase, evaluate the full extent of the data with attribute rules in the workspace.

    3. For Options, choose any of the following:
      • Modified in this version—Evaluate edits made in the current branch version. This option is only available when the source is a feature service with the Version Management capability and connected to a branch version. This option is not available when evaluating rules using the default version.
      • Execute asynchronously—Run the evaluate rules on the service asynchronously. This uses the system ValidationTools geoprocessing service, which allows for long-running processes. This option is only available when the source is a feature service with the Validation capability.
  7. When you're finished, click the drop-down button Drop-down button to collapse the options.
  8. Click the Evaluate Rules button Validate Extent.
  9. Error features are created and displayed in the Error Inspector. To view and manage errors, see Manage attribute rule errors.