I am trying to underline the first line in a three line label.
Solved! Go to Solution.
If the text contains a "<" or "&", these special characters break formatting tags. You have to replace them with "<" and "&". This line replaces both (and uses template literals)
`<UND>${Replace(Replace($feature.ParcelID, "&", "&"), "<", "<")}</UND>`
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
This code fixes it
var ownlab1 = $feature.Site;
var other = Replace("This & that", "&", "&");
'<UND>'+Text(ownlab1)+'</UND>\n' + other;
If the text contains a "<" or "&", these special characters break formatting tags. You have to replace them with "<" and "&". This line replaces both (and uses template literals)
`<UND>${Replace(Replace($feature.ParcelID, "&", "&"), "<", "<")}</UND>`
Thanks Ken,
There are no visible troublemaker characters but there may be something 'wrong' with the values that are ignoring the <UND></UND> tags.
@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 -
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.
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.
Thanks Ken and Robert, I'll give it a try!
Oookay, so I decided to enter text and it's still being naughty:
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
This code fixes it
var ownlab1 = $feature.Site;
var other = Replace("This & that", "&", "&");
'<UND>'+Text(ownlab1)+'</UND>\n' + other;