1

I am trying to create an Arcade expression in add attribute rule which will auto populate the attribute field (DPA_GROUP) in my points layer (as I create new point features) from the underlying polygon which contains a DPA_GROUP field.

Point feature: Suppression_Repair_Points Polygon feature: DirectProtectionAreas21_2 Common attribute Field in poly and point: DPA_GROUP

My arcade expression is as follows. Expression returns as valid however it will not let me save the attribute rule.

{// Calculation rule
// Suppression_repair_points, field DPA_AGENCY
// Triggers: Insert, Update

// optional:
// if DPA_AGENCY is already filled, just return its value (do nothing)
//if(!IsEmpty($feature.DPA_AGENCY)) {
// return $feature.DPA_AGENCY
//}

// load the polygon fc
var dpa_fc = FeatureSetByName($datastore, "DirectProtectionAreas21_2")

// intersect the feature with the polyons
var dpa_inter = Intersects(dpa_fc, $feature)

// if the feature doesn't intersect a dpa polygon, return null
if(dpa_inter == null || Count(dpa_inter) == 0) {
return null
}

// grab the first intersecting polygon and return its DPA_AGENCY value
return First(dpa_inter).DPA_AGENCY}
0

1 Answer 1

1

I was able to use your script and was able to get it to save by removing the last bracket } from your last line of code.

Your original last line:

return First(dpa_inter).DPA_AGENCY}

My revision of your last line:

return First(dpa_inter).DPA_AGENCY

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.