Select to view content in your preferred language

Using Attribute Expressions to Add URL with an A refferer

228
3
4 weeks ago
MackenzieBetz5
Occasional Contributor

I'm trying to add a URL to a pop up that uses one of the attribute fields as part of the URL. Which I can do with a custom attribute expression using arcade. However, to get it to go to the correct URL I need to include the <a href for the URL, for example, this works: 

 
BUT I need the URL to include the <a> refferer to actually be able to get to the website with the information - this is a security feature of the site to prevent data-scrubbing of our parcels. I would think the syntax for arcade for that would be: 
 
 
However, I get an error that the '<' is an "unexpected token" - what am I doing wrong here? I know I've gotten it to work in the past, but I changed it and did not save, so I don't have my old work. Anybody see an issue with the syntax? How do I get arcade to recognize the HTML anchor?
 
I'm not an HTML coder AT ALL, so if I'm referring to things wrong, please let me know!
 
0 Kudos
3 Replies
__JackCharde__
Regular Contributor

In your Arcade script use a template literal (string enclosed in backticks) with your feature attribute in a placeholder (the ${} syntax). Your return should look like this:

return `<a href="https://assessor.stlouiscountymo.gov/realestate/AsmtInfo.aspx?Locator=${$feature.LOCATOR}">Click Here</a>`

 

0 Kudos
MackenzieBetz5
Occasional Contributor

Thank you! However, when I try that, this is the output I get: 

test output.pngtest syntax.png

0 Kudos
__JackCharde__
Regular Contributor

Are you calculating a new/temporary field on this dataset? Are you using a popup with multiple content types? I'm thinking you may need to put this in a text content type so the html renders properly.

0 Kudos