AGOL Arcade pop up expression with ampersand in related table

235
4
03-20-2024 06:23 AM
Labels (1)
GregKeith
Occasional Contributor III

Hello! I'm trying to create a popup in an AGOL map using an Arcade expression. The popup pulls data from a related table.

The problem I'm having is that some of the text values in the related table have an ampersand, such as 'fork & spoon', 'dog & cat', and so on. I first create a popup for the table, and data displays fine. But when I create a popup for the feature in the map and add the related content, the ampersand displays as '@#38;'.

I've tried using expressions like Replace({some_field}, "&", "amp;") and similar variations, but it seems to have no effect. If it matters, the expression for the related table includes two fields, such as Replace({some_field}, "&", "amp;") + ' ' + {other_field}.

Any ideas how to deal with this? Thanks!

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

What's the context for the expression? Is it in an Arcade popup element, or just a standalone expression that shows up as a field? Is it the new map viewer, or the classic one?

Any chance the data is public?

- Josh Carlson
Kendall County GIS
0 Kudos
GregKeith
Occasional Contributor III

Unfortunately, all our actual data is covered by HIPAA privacy regulations. The context is a popup for a feature layer in an AGOL map. I'm combining two fields from the related table for a row title element in the popup. 'Dog & Cat' can appear in several records, so I want to show it as 'Dog & Cat Food', 'Dog & Cat Toys', etc., where Food and Toys are the second field.

0 Kudos
RhettZufelt
MVP Frequent Contributor

Not sure in a popup, but in a label class, this works:

NAME1.replace("&","&")

In your example, is that just a typo, or are you missing the & in "&"  ?

R_

0 Kudos
GregKeith
Occasional Contributor III

Yes a typo. The .replace method doesn't exist in Arcade, at least not for this profile. The part that really puzzles me is why the data appears correctly when I configure a popup for the related table, but in the popup for the feature, when I add related content, it always appears as &

The expression is used as the popup title in the related table, where it shows in the popup row with an arrow to click for the full info. The expression isn't available to add as a title in the feature layer popup. Maybe I can add an expression to the feature layer to return it, but then why bother setting a popup for the table, as ESRI recommends?

0 Kudos