Select to view content in your preferred language

Have one string for multiple instersected attributes from the same location in a popup via Arcade element

1263
12
Jump to solution
08-30-2023 12:45 PM
Ed_
by MVP Regular Contributor
MVP Regular Contributor

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):

SaadullahBaloch_0-1693424450957.png

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
}

 

 

 

 

Question | Analyze | Visualize
0 Kudos
12 Replies
Ed_
by MVP Regular Contributor
MVP Regular Contributor

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 🙂 

Question | Analyze | Visualize
0 Kudos
SteveCole
Frequent Contributor

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 += `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${counter}) ${f.FullAddress}<br>`;

It may work without the semi-colon but it's not suggested that you do so (link).

Ed_
by MVP Regular Contributor
MVP Regular Contributor

Nice, thank you for pointing that out Steve 🙂

Question | Analyze | Visualize
0 Kudos