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}
  • 1
    There's a {} button in the UI, which indents the block four spaces, or you can add three backticks above and below the code source.
    – Vince
    Aug 20 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.