So I am trying to pull attributes from an intersected layer in a single popup. In certain popups however, there are for example 3 layers that overlay one another in the same location. Basically 3 address points thus 3 addresses as shown in the screenshot below.
Now is there a way I can have the Address: string to appear only once?
Also is it possible to adding numbering to the addresses (if more than 1 address is present) as shown in the desired output?
@KenBuja please when you have the time, can you have a look at it? Thank you 🙂
Current output (please ignore the blue color that's just due to the mouse selection):
Desired output:
Property Summary
Address: 1) 3452 W ESFIE ST 90026
2) 3450 W EFIE ST 90026
3) 3448 W EFIE ST 90026
Code:
// Create a variable that is the FeatureSet of intersecting feature attributes
var Address = FeatureSetByName($map, "ADDRESS")
var intersectLayer = Intersects(Address, $feature)
// This variable will be used multiple times in the code
var popup = '<h3>Property Summary</h3>';
for (var f in intersectLayer){
popup += `<b>Address:</b> ${f.FullAddress} <br><br>
`
}
// Now bring in the attributes from the next intersected layer
return {
type : 'text',
text : popup
}
Solved! Go to Solution.
Good morning @KenBuja, hope all is well, oh I see, I was actually using an `if` statement on just the `counter variable`, so that's why it wasn't working.
Thank you sharing that 🙂
I don't know if the ESRI forum software stripped it out of his reply but I would add a semi-colon to Ken's solution in the appropriate spot so it should be like this:
popup += ` ${counter}) ${f.FullAddress}<br>`;
It may work without the semi-colon but it's not suggested that you do so (link).
Nice, thank you for pointing that out Steve 🙂