Select to view content in your preferred language

<UND></UND> Tags work inconsistently in Arcade

761
14
Jump to solution
02-03-2026 08:52 AM
RandyMcGregor_BMcD
Frequent Contributor

I am trying to underline the first line in a three line label.

ownlab1 = $feature.ParcelID
 
ownlab1 = '<UND>'+Text(ownlab1)+'</UND>'
 
The resulting labels sometimes work and sometimes don't.
 
I get '3232' for example, which is what I want, but also, '<UND>3234</UND>' I can't figure out what is different about lines that honor the underline tag and those which reject it.
 
Is there any logical reason for this?
 
Thank you,
 
Randy McGregor
0 Kudos
2 Solutions

Accepted Solutions
KenBuja
MVP Esteemed Contributor

If the text contains a "<" or "&", these special characters break formatting tags. You have to replace them with "&lt;" and "&amp;". This line replaces both (and uses template literals)

`<UND>${Replace(Replace($feature.ParcelID, "&", "&amp;"), "<", "&lt;")}</UND>`

 

View solution in original post

KenBuja
MVP Esteemed Contributor

What else is in the label? If anything in the label contains those special characters, then the formatting tags will break. For example, this code

var ownlab1 = $feature.Site;
var other = "This & that";
"<UND>" + Text(ownlab1) + "</UND>\n" + other;

results in this label

2026-02-04_13-27-31.PNG

This code fixes it

var ownlab1 = $feature.Site;
var other = Replace("This & that", "&", "&amp;");
'<UND>'+Text(ownlab1)+'</UND>\n' + other;

2026-02-04_13-32-29.PNG

 

View solution in original post

0 Kudos
14 Replies
KenBuja
MVP Esteemed Contributor

If the text contains a "<" or "&", these special characters break formatting tags. You have to replace them with "&lt;" and "&amp;". This line replaces both (and uses template literals)

`<UND>${Replace(Replace($feature.ParcelID, "&", "&amp;"), "<", "&lt;")}</UND>`

 

RandyMcGregor_BMcD
Frequent Contributor

Thanks Ken,

There are no visible troublemaker characters but there may be something 'wrong' with the  values that are ignoring the <UND></UND> tags.

0 Kudos
KenBuja
MVP Esteemed Contributor

What else is in your multi-line string? Do the other elements have the special characters?

Robert_LeClair
Esri Esteemed Contributor

@RandyMcGregor_BMcD - I tested this with some of my data and noticed a few formatting issues with your label expression.  Instead of a two line arcade expression, how about this - 

"<UND>"+$feature.ParcelID+"</UND>"

It works in my ArcGIS Pro 3.6.x
RandyMcGregor_BMcD
Frequent Contributor

No effect, but I appreciate the suggestion. What's weird is that it works on most labels but not others. My guess is that there are some weird characters are in the mix (but they are not clearly visible.). Maybe a unicode vs straight text deal or something nightmarish like that 😕 Thank you.

0 Kudos
Robert_LeClair
Esri Esteemed Contributor

That is odd certainly.  Is the ParcelID field a text field or a numeric field? I wonder if you could create a new field say "opposite" of ParcelID and then use the Field Calculator to populate the field?  By "opposite" I mean, if it's a numeric field, then create a new text field to do the field calculation upon, then apply the UND arcade to the new field for testing purposes.

0 Kudos
RandyMcGregor_BMcD
Frequent Contributor

Thanks Ken and Robert, I'll give it a try!

0 Kudos
RandyMcGregor_BMcD
Frequent Contributor

Oookay, so I decided to enter text and it's still being naughty:

var ownlab1 = "<UND>"+"Hi Mom"+"_</UND>"
 

RandyMcGregor_BMcD_0-1770228561295.png

 

0 Kudos
KenBuja
MVP Esteemed Contributor

What else is in the label? If anything in the label contains those special characters, then the formatting tags will break. For example, this code

var ownlab1 = $feature.Site;
var other = "This & that";
"<UND>" + Text(ownlab1) + "</UND>\n" + other;

results in this label

2026-02-04_13-27-31.PNG

This code fixes it

var ownlab1 = $feature.Site;
var other = Replace("This & that", "&", "&amp;");
'<UND>'+Text(ownlab1)+'</UND>\n' + other;

2026-02-04_13-32-29.PNG

 

0 Kudos