Select to view content in your preferred language

Control attribute rule execution order

1279
7
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.

 

7 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

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.