I have a MGDB with a point layer that contains landslides and a polygon layer containing watershed boundaries. I have been trying to create an attribute rule that automatically populates the field "Watershed1" in the point layer "main.terrain_disturbances" using a field of the same name "Watershed1" in the polygon layer "main.NNDTT_watersheds".
Following this example, which I thought tried to achieve the same thing, I wrote the following Arcade expression"
// Calculation Attribute Rule
// load the Areas poylgon class
var Watershed1 = FeatureSetByName($datastore,"NNDTT_watersheds",["Watershed1"], true)
// intersect the areas with the inserted/edited feature
var intersectLayer = Intersects(Watershed1, Geometry($feature))
if (Count(intersectLayer) > 0) {
var layer = First(intersectLayer);
return layer.Watershed1;
} else {
return null;
}
But when I save the rule my Watershed1 field is still <Null> for all features and when I try to create a new feature it gives me the following error:
Failed to create RTS.
Failed to evaluate Arcade expression. [
Rule name: Get watershed1,
Triggering event: Insert,
Class name: main.terrain_disturbances,
GlobalID: {2F371CB9-EB68-498B-887F-2A59C2FA06BE},
Arcade error: Unexpected null,
Script line: 11]
Any help would be appreciated, this is my first attribute rule, thanks!
ESRI, any help on this? Thanks