Select to view content in your preferred language

Arcade expression based conditional formatting for labels?

122
1
a month ago
DavidCantor
New Contributor

Is there any way for me to use arcade to make conditional formatting of the text in labels in ArcPRO?

Something along the lines of:

if ($feature.TYPE == 'A'){
     <text color = "Red">$feature.NAME</text>}
else{
     <text color = "Blue">$feature.NAME</text>};

I suppose I could copy the layer, and definition query out the features I want, and then label them in separate layers, but I'm wondering if there is a way to conditionally format text in arcade.

0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

Check out https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/text-formatting-tags.htm

For your expression, you'll want the <CLR> tags.

if ($feature.TYPE == 'A'){
     `<CLR red='255'>${$feature.NAME}</CLR>`
} else {
     `<CLR blue='255'>${$feature.NAME}</CLR>`
}
- Josh Carlson
Kendall County GIS