I created a popup expression in enterprise portal which uses arcade to find records from a related table (1-many) and display a name and contact information for each person found. The next request I received was to have the phone and email set with hyperlinks (this will be a mobile app).
If I create an expression for each part of the record (separate expression for name, email and phone), I can create the hyperlinks in the popup configuration, but I am afraid that the information may not be in the correct order so that the phone/email is shown for the correct person.
Here is what I have currently: (an image of the popup is attached as well)
// Get ABM information from related table
// Read out the Cluster Code of Cluster from the Cluster feature map
var CCode = $feature.ClusterCode;
// Access the Cluster ABM table
var ABMtbl = FeatureSetByName($datastore,"ABMbyCluster");
// Create a sql expression to query FK_Code on CCode
var sql = "FK_Code = '" + CCode + "'";
// Filter the table using the sql expression
var related_data = Filter(ABMtbl, sql);
// Count the resulting records
var cnt = Count(related_data);
// initiate a variable to hold the result
var result = "";
if (cnt > 0)
{
result = cnt + " Aux Board Members";
for (var row in related_data)
{
// retrieve the ABM information to write to popup
result += TextFormatting.NewLine + TextFormatting.NewLine + row.Name + " (" + row.ABMType + ")" + TextFormatting.NewLine + " mailto:" + row.Email + TextFormatting.NewLine + " tel:" + row.Phone;
$datastore
}
}
else
{ result = "No assigned ABMs"
}
return result;
Hi Christine Sharp ,
From what I can see you have the correct information, you loop through the different board members and the name, phone, email etc is from the same related "row". So far so good, I think.
The limitation when returning this data as a string, is that the web browser will not see it as a link to call or mail the person. This might behave differently in a phone browser (although I haven't tested that). You could create html from the Arcade expression, but this will not be interpreted as html and appear as text. Did you test the pop-up in the web map on a mobile device? Are the email and phone number clickable?
Hello -
Thanks for the review of my script. The resulting popup does not have any hyperlinks, just the text 'mailto:' and 'tel:', so this method doesn't work.
My thought was that maybe there is a way to create a separate expression for the name, then phone, then email for each person, but I was worried that the order may not be the same from the loop so the wrong email/phone might show with the person's name.
Hi Christine Sharp ,
There might be a solution, but this would require many expression and could result in mixing data of different rows if you are not careful. It consists of using custom HTML in the pop-up and filling just the mailto link from the Arcade expression.
In ArcGIS Pro it is already supported to construct HTML in a single Arcade expression and use that in the pop-up. This is not yet supported in the web map. See: https://community.esri.com/blogs/bock/2019/06/19/using-arcgis-pro-and-arcade-expressions-to-create-s...
I can only assume that in some moment this will be able in the web map too. But for now it isn't. How many ABM's can there be for a single feature?
Please send solutions emails to Mary Beth Vargha at mvargha@usbnc.org<mailto:mvargha@usbnc.org> as she is the technical contact and is the person submitting the help tickets.
Thank you,
Christine Sharp
Bahai National Center
I.T. Department
Business Services Coordinator
(847) 733-3456
csharp@usbnc.org<mailto:csharp@usbnc.org>
Please send solutions emails to Mary Beth Vargha at mvargha@usbnc.org<mailto:mvargha@usbnc.org> as she is the technical contact and is the person submitting the help tickets.
Thank you,
Christine Sharp
Bahai National Center
I.T. Department
Business Services Coordinator
(847) 733-3456
csharp@usbnc.org<mailto:csharp@usbnc.org>