Hello everyone!
I got stuck with an arcade issue and it's really driving me crazy.
What i need to do is following. I've got two point layers lets say pts_1 (square, hnizda in code) and pts_2 (circles, nadoby in code). PTS_1 is superior to pts_2. There is always one point in pts_1 for many points in pts_2 (pts_1 (red square) represents something like nest for another layer (colorfull circles)). I need an attribute rule to calculate count of circles around a square feature, if a circle is added, deleted or updated. This count should be written to pts_1 layer to a specific field.
![AdministrtorJihlava_0-1687932418043.png AdministrtorJihlava_0-1687932418043.png](https://community.esri.com/t5/image/serverpage/image-id/74335i488EA852CC7FB160/image-size/medium?v=v2&px=400)
I tried this code but I'm still getting this error message: Attribute rule returned a value but no field was specified in the rule. The attribute rule is performed within a pts_2 layer, because pts_1 layer is static.
var nadoby = FeatureSetByName ($datastore, "nadoby_b", ["GlobalID"],true);
var hnizda = FeatureSetByName ($datastore, "hnizda_b", ["GlobalID"],true);
var fs_polygons = Buffer(geometry(hnizda),25, 'meters');
var updates = []
if (fs_polygons !=null){
var point_count = Count(Intersects($featureset, fs_polygons));
console ("Point_count: "+point_count)
if($editcontext.editType == "DELETE") {
// $feature is still there when this rule is executed, so we have to substract 1
point_count -= 1
}
Push(updates, {globalID: $feature.GlobalID, attributes: {"plast1": point_count}})
if ($editContext.editType == "INSERT") {
var point_count = Count(Intersects($featureset, fs_polygons))
Push(updates, {globalID: $feature.GlobalID, attributes: {"plast1": point_count}})
}
}
return {
edit: [{className: "hnizda_b", updates: updates}]
}
I will be gratefull for any help.
Thanks in advance.
Jana