Hello, I'm trying to create a popup that includes a URL to report a problem based on a field. If the user chooses a State Road my pop up indicates that the road is maintained by the State but I want to include a URL to report a problem to the State. If the road is maintained by the City I want a different URL for those problems. Then I have some roads that are private that I do not wish to include a URL at all. I have a working maintenance expression to show the maintenance but I'm not sure how to show only certain jurisdictions having a URL. Thanks in advance for any help!
You'll want to use an Arcade popup element for this, where you can include HTML.
Also, when you're series of if/else/then statements are nice and simple like this, you can replace them with a When statement. "When(condition1, response1, ... conditionN, responseN, fallback_response)"
However, when your conditions all use the same field, you can also just replace it with Decode. "Decode(field, value1, response1... valueN, responseN, fallback_response)"
var maintainer = Decode(
$feature.MAINTENANCE,
'CITY', '<a href="link to city URL">The City of Annapolis</a>',
'STATE', '<a href="link to state URL">State Highway Administration</a>',
'PRIVATE', 'A Private Entity', // no link on this one!
'NAVAL ACADEMY', '<a href="link to academy URL">United States Naval Academy</a>',
'COUNTY', '<a href="link to county URL">Anne Arundel County</a>',
'FUTURE (CITY)', 'Private but future City',
'UNKNOWN'
)
return {
type: 'text',
text: maintainer
}
I don't know if this works for the original poster, but hot diggity dog I am saving this for later! (both the Decode and the HTML)