For example, if a user edits the common_name for OID1, I want the attribute rule to additionally update the common_name for OID 2. Is this possible?
OID | custom_id | common_name |
1 | "Group A" | "Name A" |
2 | "Group A" | "Name A" |
3 | "Group B" | "Name B" |
4 | "Group B" | "Name B" |
I've wondered about this, too.
I posted it as an idea: When a feature is edited, update a different feature in the same FC
Yes, that is possible.
You just have to take precautions against infinite loops (feature 1 updates f2, which in turn updates f1, which then updates f2, etc).
// Calculation Attribute Rule on TestPoints
// field: empty
// Triggers: Update
// Exclude from application evaluation!
// get the old and new value
var old_value = $originalfeature.TextField1
var new_value = $feature.TextField1
// abort if value did not change
if(new_value == old_value) { return }
// get all features with the old value that aren't the current feature
var gid = $feature.GlobalID
var other_features = Filter(FeaturesetByName($datastore, "TestPoints"), "TextField1 = @old_value AND GlobalID <> @gid")
// create and fill an update array
var updates = []
for(var f in other_features) {
Push(updates, {globalID: f.GlobalID, attributes: {TextField1: new_value}})
}
// instruct ArcGIS to update the other features
return {
edit: [{
className: "TestPoints",
updates: updates
}]
}
Before:
After refreshing the table:
Any thoughts on this issue? Calculation works and does not work depending on number of features.
Seems this user is using your code and is running into an issue. I can replicate this issue.
~Jake
Hi Jake, appreciate for your follow up regarding the problem that I have come across.
I still have not been able to figure out what the cause is. Hope someone will find a solution.