2

I'm trying to configure a popup for a polygon feature class so that when clicked attributes from a point feature class show up. For example, if I had 10 clients living in the USA, if I clicked on the USA polygon, the names of those 10 clients would appear in the popup.

So far, I can only get it to display the first value of only the firstname (first and last names are in different fields of the point layer):

var intersectLayer =Intersects(FeatureSetByName($map,"Origins"), $feature)

for (var f in intersectLayer){
return f.first_name; " "; f.last_name;
}

right now it returns:

custom: John

but I would like it to return:

 John Smith
 Lucy Stone
 Sam Addams
 Butch Cassidy

And so on.

Tried gleaning something from this but the code provided doesn't seem to work with my layers:

https://www.esri.com/arcgis-blog/products/arcgis-online/data-management/pump-up-your-pop-ups-with-arcade-and-the-living-atlas/

1 Answer 1

2

Following this example I would recommend modifying your code to return a string with all names like so:

var intersectLayer =Intersects(FeatureSetByName($map,"Origins"), $feature)

var customers = ""
for (var f in intersectLayer){
  customers += f.first_name+ " "+ f.last_name + TextFormatting.NewLine;
}
return customers
2
  • This actually returns the following error: Execution Error:Cannot assign undeclared variable
    – geoJshaun
    Oct 21, 2020 at 3:24
  • fixed it, just had to add var before the first declaration of customers.
    – Dror Bogin
    Oct 21, 2020 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.