Hi, I found in this post https://community.esri.com/t5/arcgis-online-blog/show-attachments-in-pop-ups-with-arcade/ba-p/890588 how to display the first attachment. I'd like to view the other attachments by retrieving the list of attachment identifiers using arcade to calculate a new field:
//calculate the attach IDs field
function IDs(f){
return f.ID;
}
var Attach_ = Attachments($feature);
var AttachIDs = Map(Attach_, IDs);
return Concatenate(AttachIDs,',');
I don't understand why this isn't working. Can you help me?
Thanks,
Solved! Go to Solution.
You can do it with a simple loop, no need to use Map (though it would make for more concise code).
var atts = Attachments($feature)
var ids = []
// loop through attachments and get the ids
for (var a in atts) {
Push(ids, atts[a]['ID'])
}
return Concatenate(ids, ', ')
Thanks a lot for your help
Hard to say why it isn't working. Try adding a couple Console statements to see what each step is doing, as that can identify where the process is breaking down.
/calculate the attach IDs field
function IDs(f) {
return f.ID;
}
var Attach_ = Attachments($feature);
Console(Text(Attach_));
var AttachIDs = Map(Attach_, IDs);
Console(Text(AttachIDs))
return Concatenate(AttachIDs,',');
Thank you for your reply. I get the following error : invalid expression. Error on line 8 Unknown function
Are you running this expression in ArcGIS Enterprise? Map was introduced at 11.0, so if you're on an earlier version, you won't have access to it.
Unfortunately, I'm in version 10.9!
I don't know how i can retrieve attachment identifiers...
Thanks,
You can do it with a simple loop, no need to use Map (though it would make for more concise code).
var atts = Attachments($feature)
var ids = []
// loop through attachments and get the ids
for (var a in atts) {
Push(ids, atts[a]['ID'])
}
return Concatenate(ids, ', ')
Thanks a lot for your help