Attribute rules are defined by the data author to enhance the editing experience and improve data integrity for geodatabase datasets. They can automatically populate attributes, restrict invalid edits during edit operations, and perform data validation checks on existing features. Attribute rules are defined using ArcGIS Pro and are written with the Arcade expression language. See the ArcGIS Pro documentation for an Introduction to attribute rules and Attribute rule script expression examples.
When editing a dataset with attribute rules, no additional code is required to leverage rule evaluation in your app. Any add, update, or delete feature operation may trigger rule evaluation depending on how the data author configured the rule.
Support for attribute rules
Attribute rules are supported in the following feature tables and geodatabases:
- A
ServiceFeatureTable
read directly from a web map or web scene. - A
ServiceFeatureTable
created directly from aServiceGeodatabase
by callingServiceGeodatabase.GetTable()
. - A sync-enabled mobile
Geodatabase
downloaded using theGeodatabaseSyncTask
orOfflineMapTask
. ArcGIS Enterprise 11.4 or newer feature services are required to support the download of attribute rules. - A
Geodatabase
exported from ArcGIS Pro and side loaded onto the device.
Attribute rules are not supported in a ServiceFeatureTable
created using any of its constructors. These stand-alone service feature tables lack the context of their parent geodatabase, which is required to evaluate attribute rules.
Attribute rule evaluation on the client
Using ArcGIS Pro, the data author can define whether the attribute rules are evaluated immediately, or at a specified time (deferred). Deferred attribute rules are useful if you want to perform data validation for existing features on the feature service. Rules set for immediate evaluation are evaluated during editing, after a feature is added to, updated in, or deleted from the local geodatabase. The data author can control whether attribute rules are evaluated in your app, following the ArcGIS Pro instructions in Evaluate attribute rules. For your app to evaluate attribution rules, the data author must set the Exclude from application evaluation to off.
If the rule's Exclude from application evaluation is turned off, each time you edit a feature from one of the supported feature tables, the attribution rule is evaluated locally in your app.
If the rule's Exclude from application evaluation is enabled, the attribution rule is not be evaluated in your app but on the feature service, or data source, when ServiceGeodatabase.ApplyEditsAsync()
is called or when the SyncGeodatabaseJob
completes. Edits made by the feature service due to rule execution are automatically reflected in your app if you use a ServiceGeodatabase
or in the replica version of the sync-enabled Geodatabase
. However, updates in the replica version are available for download to your app after they have been reconciled and posted to the default branch version. For more information, see the Synchronize with a replica version documentation.
If your app is editing features from a stand-alone Geodatabase
exported from ArcGIS Pro, all attribute rules are evaluated no matter the Exclude from application evaluation value. In this instance, the stand-alone Geodatabase
, unlike a sync-enabled mobile geodatabase that is a client to a backend feature service, is operating as the data source.