Attribute Rule Validation

Since version: 1.5

With the Attribute Rule Validation profile, expressions can be written to evaluate whether or not a feature meets the criteria defined in the expression. This profile is used for validation attribute rules in ArcGIS Pro. The script should return a Boolean with true indicating the feature meets the validation criteria or false indicating it does not meet the criteria.

Context

The following products implement this profile:

Spatial reference

The spatial reference of the expression's data source1 determines the execution context's spatial reference.

Time zone

The time zone of the expression's data source1 determines the execution context's default time zone.

Profile variables

Variable NameTypeDescriptionSince version
$datastoreFeatureSetCollectionA collection of layers in the same feature service or database as the $feature executing the script.1.5
$editcontext.editTypeTextIndicates whether the edit event is INSERT, UPDATE, DELETE, or NA (not applicable).1.10
$featureFeatureThe feature being evaluated for the constraint.1.5
$originalFeatureFeatureThe previous state of the feature being evaluated.1.9
$featureSetFeatureSetA collection of features in the same table as the $feature evaluating the expression.1.13

Function bundles

Core | Geometry | Data Access

Return types

Boolean | Dictionary

For a list of valid dictionary keywords, click here.

Example

The following example is a validation rule created on a poles feature class to ensure that when the structureheight is 65 feet or greater, the material must be made of steel. An error feature is generated if this is not true.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
if ($feature.structureheight >= 65)
{
    If (DomainName($feature, 'Material') == 'Steel')
    { return true; }
    else
    { return false; }
}
else
{  return true; }
  1. Data source can be a file geodatabase, mobile geodatabase, or mobile service.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.