Hello, I am seeking an advice for an Arcade expression for pop up in Map Viewer. What I would like to show in a field of pop up is, which features of Polygon class A are within the buffer feature of Polygon class B. To show that, the code does extracting attributes from Polygon feature A (Regional Area) that intersects with Polygon feature B (Buffer), and then populating the extracted attributes in a field of Polygon B. Also, when populating the attribute in the field, I would like to delete any duplicates of the extracted attributes and concatenate them with comma.
I kind of managed to prepare an expression for extracting values and concatenate them (see code below) but I am still new to Arcade, I have not found the way of deleting duplicate values and concatenate them with comma. i.e., current return includes all the duplicated values and concatenated (e.g. 1117111511131317) but I want to make it like (e.g. 11,13,15,17).
Thanks in advance for any Arcade expression solutions!
var fsReArea = FeatureSetByName($datastore, "Regional_Area", ["*"], false)
var fsReAreaIntersect = Intersects(fsReArea, Geometry($feature))
var orderRA = OrderBy(fsReAreaIntersect, "objectid ASC")
var arr = ""
for(var regionA in orderRA) {
if(regionA.Region_Code != null) {
arr += concatenate(regionA.Region_Code)
}
}
return arr