Hi everyone,
I am trying to make customizable pop-up to show data to the public. here i have filed name route url, that has links for some of the routes, put unknown for some of routes. now in the pop-up i would like to show the clickable links without showing text for (web address), and show Unknown without clickable link.
it would be very helpful to me if you assist me here.
Create an attribute expression in the pop-up. Modify the below so it says your field name.
var urlField = $feature["YourFieldName"];
// Replace with your actual field name
if (urlField == "unknown" || IsEmpty(urlField)) {
return "Unknown";
} else {
return "<a href='" + urlField + "' target='_blank'>" + "Click here" + "</a>";
}
Then add the expression to your popup like
ROUTE URL: {expression/expr0}
It will show text 'unknown' or a hyperlink 'Click here'