var fsAddress = FeatureSetByName($datastore, "Address_pnts", ["globalid"], true)
var fsListAddpnts = Intersects(fsAddress, $feature)
var AddList = []
var counter = 0
var noAddress = Count(fsListAddpnts)
if (noAddress > 0) {
for (var address in fsListAddpnts) {
AddList[counter] = {
'globalid': address.globalid,
'attributes': {
'add_district_name': $feature.DistrictName
}
}
counter++
}
return {
'result': noAddress + ' addresses found in the district.',
'edit': [{
'className': 'Address_pnts',
'updates': AddList
}]
}
} else {
return 'No address points in district.'
}