Select to view content in your preferred language

Arcade Expressions is show in the popup

379
2
03-21-2024 11:47 AM
DRae
by
Occasional Contributor

I have a iOS app that using swift maps SDK to show the map. The popup for the feature is showing all the normal fields except arcade expression field that generate the html. It is working fine in the web browser exception the custom mobile app that usng swift SDK.

The following is the arcade script on the field.

/* 
Open the Suggestions tab and choose a template to get started creating different content types for your pop-up. 
To learn more about using Arcade to create pop-up content visit: 
https://developers.arcgis.com/arcade/guide/profiles/#popup-element 
*/
var layer = "https://somedomain.com/server/rest/services/layer1/myfeature_PT/MapServer/0/";
var attachs = Attachments($feature);
var foid = $feature.objectid;
var link_arr = [`${Count(attachs)} attachments:`]

for(var a in attachs){
var atturl = `${layer}${foid}/attachments/${attachs[a].id}`
var attname = attachs[a].name
var link = `<a href="${atturl}" target="_blank">${attname}</a>`
Push(link_arr, link)
}

var links = Concatenate(link_arr, '<br>')

return { 
	type : 'text', 
	text : links //this property supports html tags 
}

 

Do I need to execute the Arcade script in swift before it show the popup? if yes, how??

 

0 Kudos
2 Replies
DavidFeinzimer
Esri Contributor

Hi @DRae, thanks for reaching out! It sounds like you're nearly there and maybe just missing a call to evaluateExpressions(). Please try incorporating that into your code to see if it helps if you don't already have it.

While we're here, are you aware of/using the PopupView component which is apart of the SDK's Toolkit? If not, I'd highly recommend looking into it. We provide a step by step tutorial as well as full example code.

I hope this helps but if not please feel free to leave a follow up.

0 Kudos
DRae
by
Occasional Contributor

 

Thank. I am looking into it. I will try and let you know whether is working

0 Kudos