I have an Arcade expression that utilizes two different feature services. The first feature service is of some points, with a name field. The second is a feature service from a Survey123 form, which contains all the data I need. I am using both to show all survey records associated to existing set locations in one popup. I managed to use a feature set expression to grab all the survey data and it's displayed how I want. However, since attachments (photos) are allowed, I need these to be shown as well. The arcade expression uses a for-loop to go through each survey and output each by submission. I can only manage to get the links to post on the popup as a string,, but cannot get them to be hyperlinked. Is there a way to get the string to be hyperlinked within my expression, and preserve the format?
Thanks in advance!
Solved! Go to Solution.
You'll want to use an Arcade element instead of a text element to show clickable links. Here's one way to do this, which also uses template literals
var p = Portal("https://arcgis.com");
var features = FeatureSetByPortalItem(p, "<feature ID>", 0, ["zone_name", "maintained_yn", "maintained_date", "Maint_Activity", "groups_involved", "notes", "picture"]);
var plot = $feature.Zone_Name;
var filterStatement = "zone_name = @plot";
var relatedData = Filter(features, filterStatement);
var relatedDataSorted = OrderBy(relatedData, "maintained_date ASC");
var popupString = "";
for (var f in relatedDataSorted) {
//var pic = f.picture;
popupString += `${text(f.maintained_date, "MM/DD/YYYY")}<br/>
Native Plant Zone: ${f.zone_name}<br/>
Maintained?: ${f.maintained_yn}<br/>
Maintenance Activity: ${f.Maint_Activity}<br/>
Groups Involved: ${f.groups_involved}<br/>
Notes: ${f.notes}<br/>
<a href="${f.picture}">Photo</a><br/><br/>`
}
return {
type : 'text',
text : popupString
}
You'll want to use an Arcade element instead of a text element to show clickable links. Here's one way to do this, which also uses template literals
var p = Portal("https://arcgis.com");
var features = FeatureSetByPortalItem(p, "<feature ID>", 0, ["zone_name", "maintained_yn", "maintained_date", "Maint_Activity", "groups_involved", "notes", "picture"]);
var plot = $feature.Zone_Name;
var filterStatement = "zone_name = @plot";
var relatedData = Filter(features, filterStatement);
var relatedDataSorted = OrderBy(relatedData, "maintained_date ASC");
var popupString = "";
for (var f in relatedDataSorted) {
//var pic = f.picture;
popupString += `${text(f.maintained_date, "MM/DD/YYYY")}<br/>
Native Plant Zone: ${f.zone_name}<br/>
Maintained?: ${f.maintained_yn}<br/>
Maintenance Activity: ${f.Maint_Activity}<br/>
Groups Involved: ${f.groups_involved}<br/>
Notes: ${f.notes}<br/>
<a href="${f.picture}">Photo</a><br/><br/>`
}
return {
type : 'text',
text : popupString
}
This worked! Thanks! I will remember this going forward!