Select to view content in your preferred language

Update parent table from child table in case of Delete trigger

989
5
08-29-2023 06:24 AM
CarlosK
Emerging Contributor

 

Hi,

I have a use case where I have created a constraint in Delete trigger on ChildTable whether to allow that delete. I also have to update one column of the ParentTable from that same Delete trigger. But thats not happening.

I have multiple conditions for that calculation rule but to avoid confusion I wrote it in a simple way where I am updating the ParentTable's column "Field" on deleting ChildTable row.

return {
"edit": [{
"className": "ParentTable",
"updates": [{
"GlobalID": $feature.ParentTableId,
"Field": 1
}]
}]
}

On delete no error is coming but value of Field in ParentTable is also not updating to 1 when deleting ChildTable's row. Also ChildTable's constraint to delete row is working fine but the above attribute rule is not working

@HusseinNasser2 

Tags (1)
0 Kudos
5 Replies
HusseinNasser2
Esri Contributor

Hey Carlos

 

Do you know version of Pro are you using for this (and is this filegdb or mobilegdb?)

Is this a relationship? or something you maintain manually 

 

if it is relationship we have fixed few bugs with attribute rules eventing and patched them to 2.9.10/3.0.6 and 3.1.3 make sure you are using those.

I'm attaching a sample for insert/update and delete. This is a pole feature that is related to an inspection table. (one pole has many inspections), every time you add an inspection record the count of inspections (a field on the pole) gets updated. if you delete it gets updated accordingly, 

this only work with the fixes in the patches mentioned. 

 

0 Kudos
CarlosK
Emerging Contributor

I am right now using the latest Pro version.We are using enterprise geodatabase(sql). And this is a relationship.

@HusseinNasser2 

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

Take a look at this, it does not rely on a relationship, but a child/parent key - https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/UpdateParentFeatur...

 

0 Kudos
JamesBooth
Regular Contributor

Any chance that calculation can be shared again? Link doesn't seem to be active. Perhaps not relevant to ArcGIS Pro 3.3 or greater?

0 Kudos