Select to view content in your preferred language

Arcade expression returns HTML in Pro, but not Online

06-22-2023 08:48 PM
Labels (2)
Occasional Contributor III

Short version: I have an Arcade expression in Pro that returns HTML. When used in a popup text element, Pro displays the HTML as expected. When I publish to ArcGIS Online, it displays the source of the HTML, rather than rendering it. Am I doing something wrong, or is this just a limitation?


More Info:

My expression: This just converts a semicolon delimited list into HTML bullets. It is named "Populations". 


if (IsEmpty($feature.test_list)) {return "[<i>None found</i>]"}

return "<ul><li>" + Replace($feature.test_list, "; ", "<li>") + "</ul>"



I have a simple text popup that displays this expression:


The popup renders the HTML in Pro as expected. This is just dummy data for testing, but the field value is "Otter; Bear; Lynx". Here is what displays:


When I share this to a hosted feature layer in ArcGIS Online, the expression comes across fine under the new item's "Visualization" tab. When I click on a feature, the expression runs and returns the HTML, but the popup just renders it as text. 



After failing to make it work with a text element and expressions, I got something similar working as an Arcade element. I couldn't figure out how to consume the expression there, so I recreated the expression as functions. This approach did render the HTML in ArcGIS Online, and it also worked when I added that hosted feature layer as a Pro map layer.


This functionally does the same thing as consuming an expression in a text element, but solves it in a different way. Maybe I'm missing something, but I thought the whole point of Arcade was that it was supposed to be portable and work anywhere!?!?


Question: Pro renders HTML returned from an expression in the popups, but ArcGIS Online does not. Is there some way to get that to work, or is that just a limitation?

If I can't solve this, I think I'll just design my popups in ArcGIS Online using the Arcade element type. I can pull them into Pro as needed. Is that a pretty common workflow? I really like having instantaneous access to the console in a browser for development, so maybe this really is the way to go.


0 Kudos
1 Reply
Occasional Contributor

I had a similar problem a few months back; we had a popup that worked fine in Classic Map Viewer, but not the new one. I want to say I found a document saying HTML expressions are not recognized as such in Text element, but memory is a little hazy at this point...

I wound up doing what you did in an Arcade element. Afterwards I made the functions generic enough that I can re-use them wherever, and now I don't bother with Text; pure Arcade is less work to setup and easier to maintain for what I need it for. Definitely prefer the AGOL editor too. 

0 Kudos