All,
I am attempting to make an Arcade expression that automatically counts up flags placed inside of a polygon. I attempted to grab the counting portion from another user but that aspect of the expression continues to fail. The intersect portion also does not seem to be working correctly. I have attached a sample code. Any suggestions/advice would be greatly appreciated! Thanks in advance.
If (IsEmpty($feature.Flag)) {
var numberlist = FeatureSetByName ($map, "Wetland")
var topnum = Top(OrderBy(numberlist, 'Flag DESC'), 1)
var counter = Number(max(topnum, 'Flag))
var Flag = counter + 1
var polygons = FeatureSetByName($map, "Boundary")
var i_polygon = First(Intersects(polygons, $feature))
if(i_polygon == null) {return null}
}
return i_polygon.Name + Flag