I am attempting to apply a fairly simple attribute rule to a feature class in an Enterprise geodatabase. I have a polygon layer and a point layer that participate in a relationship class. I am trying to create an attribute rule on a field in the polygon layer that makes it so when the corresponding field in the point feature class is updated, the field in the polygon layer is automatically updated with that same value.
I found a script on another Esri Community post that accomplishes this using FeatureSetByName and Filter and got the arcade script to return the result I am looking for in a pop-up, but when I use that same code in the attribute rule expression box, the rule is not enforced when data is updated. I will note that both features are in the same Geodatabase. Additionally, I created a script that accomplishes the same goal using FeatureSetByRelationshipName which also worked in pop-ups but not for an attribute rule. Below are examples of both of the scripts:
// Updating field using FeatureSetByName
var key = $feature["KeyField"]
// search for related features in point feature layer
var points= FeatureSetByName($datastore, "pointlayer", ["KeyField"], "UpdateField"], false)
var filtered_fc = Filter(points, "KeyField = ")
// if no related features found
if(Count(filtered_fc) == 0) {
return null
}
// related feature(s) found -> return UpdateField of the first one
return First(filtered_fc)["UpdateField"]// Updating field using FeatureSetByRelationshipName
Var relationship = FeatureSetByRelationshipName($feature, 'point_polygon_rc', ['UpdateField'], false);
if(Count(relationship) == 0) { return null }
return First(relationship)["UpdateField"]