Since version: 1.5
With the Attribute Rule Constraint profile, expressions can be written to evaluate whether or not a feature meets the criteria defined in the expression. This profile is used for constraint attribute rules in ArcGIS Pro. The script should return a Boolean with true
indicating the feature meets the constraint criteria or false
indicating it does not meet the criteria. You can also return a custom error message by returning a Dictionary of error
.
Context
The following products implement this profile:
- ArcGIS Pro
- ArcGIS Enterprise
- ArcGIS Maps SDKs for Native Apps
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 Name | Type | Description | Since version |
---|---|---|---|
$datastore | FeatureSetCollection | A collection of layers in the same feature service or database as the $feature executing the script. | 1.5 |
$editcontext.editType | Text | Indicates whether the edit event is INSERT , UPDATE , DELETE , or NA (not applicable). | 1.10 |
$feature | Feature | The feature being evaluated for the constraint. | 1.5 |
$originalFeature | Feature | The previous state of the feature being evaluated. | 1.9 |
$featureSet | FeatureSet | A collection of features in the same table as the $feature evaluating the expression. | 1.13 |
Function bundles
Core | Geometry | Data Access
Return types
For a list of valid dictionary keywords, click here.
Example
The following expression demonstrates how to prevent a feature from being deleted unless the feature is retired.
if ($feature.lifecyclestatus == 128 || $feature.lifecyclestatus == 64)
{
return true;
}
return {'errorMessage': 'You are not allowed delete a feature until it is retired'};
- Data source can be a file geodatabase, mobile geodatabase, or mobile service.