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.
The following attribute rules are supported for feature tables and geodatabases:
ServiceFeatureTable, when created directly from a
ServiceGeodatabase.getTable(), for example).
ServiceFeatureTable, when read from a web map or web scene.
- A stand-alone
Geodatabaseexported from ArcGIS Pro and side loaded onto the device.
Attribute rules are not supported for these types of feature tables and geodatabases:
A stand-alone service feature table, created as a new instance of
ServiceFeatureTablerather than using a web map, web scene, or the
ServiceGeodatabase.getTable()method. Stand-alone service feature tables lack the context of their parent geodatabase, which is required to evaluate attribute rules.
Using ArcGIS Pro, you can define whether your attribute rule runs immediately or at a specified time. Rules that run immediately are evaluated after a feature is added, updated, or deleted. Rules that run at a specified time are useful for performing data validation on existing features. Attribute rules are always evaluated by the data source, but for rules that run immediately, you can also control whether or not they are evaluated by a client. For more information see Evaluate attribute rules in the ArcGIS Pro documentation.
In a connected workflow, your app is a client for the backing feature service. The feature server or database the app works with is considered the data source. If client evaluation is disabled for a rule, it will not be executed in your app, only in the backend data source.
If client evaluation is disabled for a rule, it will not be executed in your app but will be evaluated on the server when
ServiceGeodatabase.applyEdits() is called. Edits made by the server due to rule execution are automatically reflected in your app.
If working with a stand-alone geodatabase, however, your app is considered both a client for the backing feature service and the data source. Since there is no other data source that the app communicates with, all changes are written directly to the stand-alone geodatabase. If client evaluation is disabled for a rule, it will still be executed in your app, not as the client but because the local geodatabase acts as the backend data source.