Select to view content in your preferred language

Assign Label Color Using Arcade Expression in ArcGIS Pro

53
2
Jump to solution
yesterday
MyEthiopia
Regular Contributor

Hi Everyone,

I used this arcade expression $feature.Name + TextFormatting.NewLine + "<CLR red = '255'>"+ $feature.Address +"</CLR>"

The issue is that some labels have the red color will others show the whole expression. I am lost on what could be the issue. 

MyEthiopia_1-1740082555948.png

 

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

The feature name contains special characters (& or <), which causes the formatting to fail. You have to replace those characters with their equivalent character codes (&amp; and &lt;)

replace($feature.Name, "&", "&amp;") + TextFormatting.NewLine + "<CLR red = '255'>"+ $feature.Address +"</CLR>"

 

 

View solution in original post

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor

The feature name contains special characters (& or <), which causes the formatting to fail. You have to replace those characters with their equivalent character codes (&amp; and &lt;)

replace($feature.Name, "&", "&amp;") + TextFormatting.NewLine + "<CLR red = '255'>"+ $feature.Address +"</CLR>"

 

 

0 Kudos
MyEthiopia
Regular Contributor

Thank you, Ken!! This saved me so much headache. And it makes perfect sense 

0 Kudos