Select to view content in your preferred language

Pop-Ups: Link Feature (text, hyperlink) to Another (text) with Arcade?

253
1
03-06-2025 10:28 AM
BaileyDeSimone
New Contributor

Hello,

I am attempting to link one feature to another, and am having no luck. For context, I am attempting to link the URLs to the text contained in the Incorporation_Citation feature, which only appears for two of my map points. The final text and citation should appear on the final line of the pop-up.

I have attempted this with two valid scripts:

 

if(IsEmpty($feature.Incorporation_Citation))
{return null}
else if (name == 'Alaska') {return <a target="_blank" rel="noopener noreferrer" href=https://tile.loc.gov/storage-services/service/ll/cfr/cf/r1/95/90/03/-T/3C/I/cfr1959003-T3CI/cfr19590...>$feature.Incorporation_Citation</a>}
else if (name == 'New Mexico') {return <a target="_blank" rel="noopener noreferrer" href=https://tile.loc.gov/storage-services/service/ll/llsl/llsl-c62/llsl-c62.pdf#page=2005>$feature.Incorporation_Citation</a>}

 

And:

 

var state = $feature.Name
var inc_citation = $feature.Incorporation_Citation
var url =
WHEN(
$feature.Name == 'Alaska', 'https://tile.loc.gov/storage-services/service/ll/cfr/cf/r1/95/90/03/-T/3C/I/cfr1959003-T3CI/cfr19590...',
$feature.Name == 'New Mexico', 'https://tile.loc.gov/storage-services/service/ll/llsl/llsl-c62/llsl-c62.pdf#page=2005'
)
When($feature.Name == 'Alaska', 'https://tile.loc.gov/storage-services/service/ll/cfr/cf/r1/95/90/03/-T/3C/I/cfr1959003-T3CI/cfr19590...','')
return {
type : 'text',
text : `<p><a href=${url} target="_blank">${inc_citation}</a></p>`
}
When($feature.Name == 'New Mexico', 'https://tile.loc.gov/storage-services/service/ll/llsl/llsl-c62/llsl-c62.pdf#page=2005','')
return {
type : 'text',
text : `<p><a href=${url} target="_blank">${inc_citation}</a></p>`
}

When I attempt to include it, the Arcade expression does not return the linked text. Embedding either of these scripts directly into another expression also does not work.

I have also tried to create this as an Arcade expression, rather than an attribute expression, as another content portion of the pop-up itself, which also does not work.

I'm fairly new to working with Arcade, so any base scripts or direction towards which specific functions I should use would be incredibly helpful. Thank you!

Tags (2)
0 Kudos
1 Reply
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @BaileyDeSimone,

Your arcade expression is returning the hyperlinks as text values which is why they cannot be read so that may be the issue.

var state = $feature.Name
var inc_citation = $feature.Incorporation_Citation
var Value = Null
var url = WHEN(
	state == 'Alaska', Value ='<p><a href=${https://tile.loc.gov/storage-services/service/ll/cfr/cf/r1/95/90/03/-T/3C/I/cfr1959003-T3CI/cfr19590... target="_blank">${inc_citation}</a></p>',
	state == 'New Mexico', Value ='<p><a href=${https://tile.loc.gov/storage-services/service/ll/llsl/llsl-c62/llsl-c62.pdf#page=2005} target="_blank">${inc_citation}</a></p>'
	)
if( !IsEmpty( Value ) ){ return Value }

One thing you can try is to paste the full hyperlink in a field and then use arcade to pull both links when the attributes match. Another option is to create a standalone table, copy and paste the hyperlinks in one field and designate the corresponding attribute in another. Then when you create the popup you can reference that table and attribute which should get you the corresponding link.

0 Kudos