I'm writing an immediate calculation attribute rule using Pro version 2.6.1. I have a relationship defined between a parent feature and children objects. Whenever the user changes either the parent or any of its children, I need to update a field on the parent feature. Is this possible using Arcade and immediate calculation attribute rules? I've written the rule and it works fine when I change the parent feature, but it doesn't fire when I change the related child objects. Then I began writing a second rule for the child object, but I realized that I would ultimately be changing something on the parent feature, which I do not think can be done using Arcade and immediate calculation attribute rules. The rule would also have to execute whenever a new object is related to the parent or an existing object is unrelated from the parent.
Solved! Go to Solution.
Yes this is definitely possible,
Assuming two tables T1, T2 , T1 is related to T2 via field KEY
you will add an attribute rule on T1 and you can have it trigger on update so that it makes an edit to T2 and update the related feature on T1 (find the parent feature by querying T1.KEY = $feature.KEY ..
Here is a blog detailing this
Advanced Attribute Rules – Editing features on another class with attribute rules
You can restrict the attribute rule to execute only if a certain field has been updated by using $originalFeature
Hussein Nasser Michael Miller Hi Hussein and Mike, Do you know if this is possible?
Thank you!
Yes this is definitely possible,
Assuming two tables T1, T2 , T1 is related to T2 via field KEY
you will add an attribute rule on T1 and you can have it trigger on update so that it makes an edit to T2 and update the related feature on T1 (find the parent feature by querying T1.KEY = $feature.KEY ..
Here is a blog detailing this
Advanced Attribute Rules – Editing features on another class with attribute rules
You can restrict the attribute rule to execute only if a certain field has been updated by using $originalFeature
Thank you!
Is it possible to know when a related child object has been unrelated from its parent feature? I'm using $originalFeature and can compare it to $feature to determine if the child was related to a parent and now is been unrelated. I wrote a Calculation Rule and set the trigger to Update, but the code I wrote doesn't seem to get executed when I remove a child from a relationship in Pro. I want to set a field on the parent to null in the case of a child becoming unrelated. Is removing a child from a relationship not considered an Update?
Yes it is possible,
create a constraint attribute rule on an update trigger and use $feature to query the related table to see if object still exist in the related table and block the edit if the object has been severed from the parent.
if you found a row that means the object still related, if you didn't that mean the object has just been recently removed and as a result you can block that by return false.
I do not want to prevent the child from being unrelated to the parent. I want a field on the parent to be set to null if the user chooses to unrelate a child from the parent as shown in the screen shot below. Will a constraint rule allow me to do this?
Yup you can do this with a calculation rule easily.
constrain prevent edits, calculation changes the state of the row.