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;