Attribute rules enhance the editing experience and improve data integrity for geodatabase datasets. They are user-defined rules that 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, there is no additional code required to leverage rule evaluation in your app. Any add, update, or delete feature operation may trigger rule evaluation depending on how you've 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.table(withLayerID:)
. - 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, you can define whether your attribute rules are evaluated immediately, or whether they are evaluated at a specified time (deferred). Deferred rules are useful if you want to perform data validation on existing features on the feature service. Rules that run immediately are evaluated during editing after a feature is added, updated, or deleted. You can control whether attribute rules are evaluated by your app, by following the ArcGIS Pro instructions in Evaluate attribute rules. For your app to evaluate attribution rules, you must also ensure their Exclude from application evaluation is disabled.
If the rule's Exclude from application evaluation is disabled, every time you edit a feature from one of the supported feature tables, the attribution rule will be evaluated locally in your app.
If the rule's Exclude from application evaluation is enabled, the attribution rule will not be evaluated in your app but they will be evaluated on the feature server, or data source, when ServiceGeodatabase.applyEdits()
is called or when SyncGeodatabaseJob
completes. Edits made by the feature server 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, these updates in the replica version will only be available for download to your app once 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 will be evaluated. The stand-alone Geodatabase
, unlike a sync-enabled mobile geodatabase that is only a client to a backend feature service, is operating as the data source so every attribute rule is evaluated even if its Exclude from application evaluation value is enabled.