I need to be able to show data with a one to many relationship. I have the data coming out correctly but the links are merging together into one web link. I need the links to be individual links.
This is the map we're talking about: Tacoma City Council Districts Web Map Update-Copy (arcgis.com)
The old and hard way:
// Expression for the name index = 0 // <- change this number in each name expression var areas =FeatureSetByName($map,"Neighborhood Council Districts (Tacoma)"); var Onefifty = Buffer($Feature, -150, 'feet') var countp = Intersects(areas,Onefifty); var i = 0 for(var c in countp) { if(i == index) { return c.Neighborhood } i++ } return ''
// Expression for the url index = 0 // <- change this number in each name expression var areas =FeatureSetByName($map,"Neighborhood Council Districts (Tacoma)"); var Onefifty = Buffer($Feature, -150, 'feet') var countp = Intersects(areas,Onefifty); var i = 0 for(var c in countp) { if(i == index) { return c.URL } i++ } return ''
Your popup would look like this:
The new and far better way: Just use an Arcade element! With this element, you can return HTML code which will be interpreted by the popup.
var areas =FeatureSetByName($map,"Neighborhood Council Districts (Tacoma)"); var Onefifty = Buffer($Feature, -150, 'feet') var countp = Intersects(areas,Onefifty); var result = ""; for (var item in countp){ var name = item["Neighborhood"]; var url = item["URL"] result += `<a href="${url}" target="_blank">${name}</a><br/>` } return { type : 'text', text : result }
Hi Johannes,
Thank you so very much! I love seeing this work. I really want to dive deeper into Arcade and now I can learn more about Arcade elements. It all makes sense now because I had been seeing other examples of people using Html code in their Arcade code. Now I can finish up this little project and on to my next project. I hope you have a fantastic day. You have definitely made a new friend for life.
Thank you,
John
Hi, sorry I could not be of much help, as I have been away. I am glad you have the problem solved.
cheers, good luck on your 'exploration'.
Pedro
Thanks for the helpful tips! The link to the map requires credentials, and is not accessible for most of the community.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.