Expression in a popup. Feature Attribute + URL

342
3
09-26-2022 03:07 AM
Labels (3)
DavidRasner1
New Contributor III

Hello,

I'm trying to create an attribute in a popup (map viewer) using an expression that combines an attribute value + URL. I want the user to see the value and be able to click on a link to an external service with more details, if he so desires.

Map viewer conveniently converts all "https://" URLs into "View":

DavidRasner1_0-1664186506525.png

But not with the concatenate function?

Example: Concatenate($feature["BFS_EGID"]," ","https://map.geo.admin.ch/")

Results in:

DavidRasner1_1-1664186666279.png

I want:

1026838 View

Is that even possible?

 

0 Kudos
3 Replies
DavidRasner1
New Contributor III

One way i just found is to use HTML in the rich text editor: https://doc.arcgis.com/en/arcgis-online/reference/supported-html.htm

I would have to create a feature table from scratch, standards hrefs work fine. HTML in expressions doesn't seem to be possible.

🤔

Maybe?

0 Kudos
jcarlson
MVP Esteemed Contributor

As you've found, expression-based URLs will not work when the expression is directly being read as an attribute. However, if you add an Arcade element to the popup itself, you'll be able to accomplish this, as it interprets HTML tags correctly.

jcarlson_0-1664212882064.png

 

var id = $feature["BFS_EGID"]
var url = 'https://map.geo.admin.ch/'

var out_txt = `${id}
<a href="${url}">View</a>`

return { 
	type : 'text', 
	text : out_txt
}

 

jcarlson_1-1664213211989.png

 

- Josh Carlson
Kendall County GIS
AbiodunKaka1
New Contributor

Nice

0 Kudos