J’ai besoin d’aide pour créer un script Arcade personnalisé afin d’afficher les pièces jointes dans une fenêtre contextuelle en fonction du type de fichier. J’ai joint un JPEG et un PDF à un point de données Survey123.
Can you share your Arcade expression? I'm assuming you're using the Attachments function? There is an optional types parameter to filter the resulting array based on its filetype. That should be all you need to accomplish this.
I do not have an expression currently. I am still very new to writing expressions and I had no success in searching online for where to start.
I was trying to use this site to start: Visualize Your Attachments in ArcGIS Online with Arcade (esri.com)
But I understand that this is more for the symbology and not filtering attachments in a pop-up
Hey Josh, following along here.
It's pretty easy to get a list of the attachments with Attachments(), but do you know how to get a link to them?
I'm able to generate a list of names pretty easily, and even get a URL going, but I can't get a token for the items.
var ret= [] //var urlbase = "Path to my feature class" var attList = Attachments($feature, {"types":["application/pdf"]}) for (var att in attList) { Push(ret, attList[att].name) //var url = Concatenate([urlbase,$feature.OBJECTID,"attachments", attList[att].id, "?token="], "/") //Push(ret, url) } return ret
Yields
Constructing the url instead yields a functional URL, but without figuring the token I can't actually link the attachments.
(Also for some reason I can't get the HTML for hyperlinks working, so I'm not bothering to put it here)
Once the token is determined, would this yield only PDF attachments and not JPEGs?
Yes. The second part of the Attachments() function filters them by file type.
These are the point's attachments. The PNG is filtered out.
Les membres connectés peuvent publier, suivre les mises à jour et bien plus encore. Vous êtes nouveau ici ? Créez un compte gratuit.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.