From @JohannesLindner :
If multiple rules trigger on the same table, you have no control over the execution order, which can give unwanted results if a rule depends on a field that is calculated by another rule.
Could attribute rules be enhanced so that we can control the execution order? That would allow us to split huge attribute rules into smaller more manageable rules.
Thanks Mike. Just to clarify, does that functionality fully/currently exist in Pro? Or is it coming in a future version?
That screen shot was from 2.9. I believe it has always been there for calculation rules. It is not present for constraint.
@MikeMillerGISand @JohannesLindner:
Would there be any benefit in controlling attribute rule order of execution globally for that FC/table?
For example, the order ID would be a unique number between all calculation, constraint, and validation rules. The order ID would be honored, regardless of what kind of attribute rule is.
For example:
I don't have a lot of experience with attribute rules. So I don't know if that's sensible or not.
Thanks everyone for your ideas and comments!
There are two ways that you are able to alter the execution order of the attribute rules on a class.
1. As mentioned, giving a new order number to a rule in the attribute rules view will reorder the rules without the need to delete and recreate.
2. If you are looking for a programmatic approach, the reorder attribute rules GP tool will also allow you to script changes to the execution order of existing calculation attribute rules.
Immediate calculation and constraint rules are evaluated during edit operations for specific triggering events (insert, update, and delete) defined in the rule properties on the class being edited.
Immediate calculation rules are evaluated first in their respective order followed by constraint rules.
As constraint rules do not change the state of the data, they have no specified order.
Thanks @SSWoodward for clarifying the order of execution for Attribute Rules especially with Calculation first and then Constraint. It will be nice if the documentation mentions the order.
Is it safe to assume both immediate calculation and constraint rules fire "after event" i.e. after insert/update/delete event has occurred and database row now reflects the event action?
In database speak, are they similar to "after <event> for each row" trigger? e.g. if we want to check count of child features using FeatureSetByRelationshipName, it will include current feature being added as child feature?
Thanks,
Vish
On a side note, I found this interesting, just in general regarding how ArcGIS creates records in the DB, (not related to attribute rules).
I agree @EstherSmith_Dev . The doc link you shared does have a section on evaluation order below the sections that describe the different rule types. The section links to the more extensive doc on evaluation order.
I'll chat with the team and see if there is a way to feature it more prominently.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.