Select to view content in your preferred language

Control attribute rule execution order

2050
11
03-20-2023 08:38 PM
Status: Already Offered
Bud
by
Esteemed Contributor

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. 

Lessons Learned — Attribute Rules 

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.

 

11 Comments
MikeMillerGIS
Status changed to: In Product Plan

You can define the order of calculation attribute rules:

MikeMillerGIS_0-1679409905823.png

 

Bud
by

@MikeMillerGIS 

Thanks Mike. Just to clarify, does that functionality fully/currently exist in Pro? Or is it coming in a future version?

MikeMillerGIS

That screen shot was from 2.9.  I believe it has always been there for calculation rules.  It is not present for constraint.

Bud
by

@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:

  1. Calculation rule
  2. Constraint rule
  3. Calculation rule
  4. Calculation rule
  5. Validation rule
  6. Constraint rule

I don't have a lot of experience with attribute rules. So I don't know if that's sensible or not.

RPGIS
by MVP Regular Contributor

You can always change the order of a rule by simply double clicking on the order number and changing it manually to the desired order.

Bud
by
SSWoodward
Status changed to: Already Offered

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. 

EstherSmith_Dev

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

Bud
by

On a side note, I found this interesting, just in general regarding how ArcGIS creates records in the DB, (not related to attribute rules).

 

"ArcGIS seems to execute two db operations to create a spatial record:
 
-Create the geometry and OBJECTID.
-Update the record with the rest of the attribute values.
 
It looks like one operation to the front-end user, but in the background it is actually two."
 
 
SSWoodward

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.