I have a point layer of farms with several features, including a TRUE/FALSE field which tells me if the farm has submitted data that we require. We would like to be able to overlay this with a polygon layer of provinces to see per province how many farms have submitted the data, and then list their names in the polygon pop-up.
Please note that I am very new to arcade.
I have succeeded in the first expression of counting the farms, and am well on my way with the second expression, but I keep running into the following problem: According to multiple blogs/questions https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2018/12/10/overlapping-features-in-pop-ups-quick-introduction-to-using-featuresets-with-arcade, Using FeatureSetBy functions in Arcade to drill-down to other layers and tables, my script looks as it should as far as I can see:
var farms = FeatureSetByName($map,"CoordinatesMasterZonal");
var gis = Intersects(Filter(farms,"GIS_Submitted LIKE 'TRUE'"),$feature);
var gistrue = "";
if (gis > 0) {
for (var f in gis) {
gistrue = f.Site_Name + ". "+ TextFormatting.NewLine + "View their BEIA report here";
}
} else {
gistrue = "No farms in this province have submitted GIS data yet"
}
return gistrue
However, this gives me an output like non of the farms have submitted the data for all provinces, even when I know that there are farms intersecting that have submitted the data.
The following does give me a better output:
var farms = FeatureSetByName($map,"CoordinatesMasterZonal");
var gis = Intersects(Filter(farms,"GIS_Submitted LIKE 'TRUE'"),$feature);
for (var f in gis) {
gis = f.Site_Name + ". "+ TextFormatting.NewLine + "View their BEIA report here";
}
return gis
But it doesn't loop through the "gis" list and only gives me one value for each province.
What am I missing here to achieve a full list per province?
Thanks!