I have a point feature class named Shelters. There is a field named "SHELTERPREPLAN" in the default pop up. This field has Yes and No values.
I am learning Arcade. I need to make a conditional popup where if SHELTERPREPLAN = Yes then the "Yes" would be a link to a hyperlink; If SHELTERPREPLAN = No, then no action would be taken.
I know that I need to use href somewhere maybe like this:
<a href="myurl">Yes</a>
Here is the expression I have created, maybe someone out there can give me a little push in the right direction:
IIF($feature["SHELTERPREPLAN"]=="Yes", "myurl", "")
The above bit of code outputs the url in the SHELTERPREPLAN field. But what is the best way to add the href so the Yes becomes a link to the url?
I am using Map Viewer Classic or can use Map Viewer if this helps.
Solved! Go to Solution.
The code below will return the value in a field called myURL, with the display text as Yes. It will only show this if Shelter Plan is equal to Yes. Any other value will result in a blank.
I did this in Map Viewer, mainly because the Arcade editor is much easier to work with since it provides suggestions.
if ($feature.SHELTERPLAN == "Yes"){
return {
type : 'text',
text : '<a href=' + $feature.myURL + '>Yes</a>' //this property supports html tags
}
}
The code below will return the value in a field called myURL, with the display text as Yes. It will only show this if Shelter Plan is equal to Yes. Any other value will result in a blank.
I did this in Map Viewer, mainly because the Arcade editor is much easier to work with since it provides suggestions.
if ($feature.SHELTERPLAN == "Yes"){
return {
type : 'text',
text : '<a href=' + $feature.myURL + '>Yes</a>' //this property supports html tags
}
}