I have a hosted feature service with Attachments, and I want to create a list of indices of the attachments per feature. Ultimately, I want to get the position of each attachment per feature.
I used Array(Count(Attachments($feature)), which creates an array based on the number of attachment the feature has, but I'm stuck here. I'm new to Arcade and will appreciate any help!
Solved! Go to Solution.
var attachments = Attachments($feature)
var txt = []
for(var a in attachments){
Push(txt, a+1)
}
return Concatenate(txt, ", ")
What's your end goal here? Because I fear it's linking those indices to the attachments. If so, you're on the wrong track.
Hi @pat_algura
Attachments($feature) will gives you the dictionary of the attachments per feature.
You can then loop through the dictionary to get the id.
var attachments = Attachments($feature)
var txt = ""
for(var attach in attachments){
txt += (attachments[attach].id) + ","
}
return txt
Cheers,
Tang
Thanks for responding @SzuNyiapTang
This approach pulls the attachment ids though instead of indices.
For each element, I want it to show:
Attachment List |
1,2,3,4,5 |
1,2,3,4 |
1,2,3,4 |
Thanks,
Patricia
var attachments = Attachments($feature)
var txt = []
for(var a in attachments){
Push(txt, a+1)
}
return Concatenate(txt, ", ")
What's your end goal here? Because I fear it's linking those indices to the attachments. If so, you're on the wrong track.
Thank you! This is exactly what I'm trying to achieve 😄
Cheers,
Patricia