Select to view content in your preferred language

Arcade conditional color text label not working in Pro

1133
2
Jump to solution
04-26-2022 05:18 PM
Jen_Zumbado-Hannibal
Frequent Contributor

I have been trying to create an arcade expression base on the condition of an attribute. I'm on the latest 2.9.2 of ArcGIS Pro.

Here is my expression in label properties: 

 

if(DomainName($feature, 'Private')=="Yes") {
return "<CLR red= '197', green= '0', blue='255'>"+ $feature.AssetId+ "</CLR>"
}
else {
return "<CLR red= '56', green= '168', blue='0'>" + $feature.AssetId + "</CLR>"
}

 

The first color is purple

The second is green

Jen_ZumbadoHannibal_0-1651018272345.png

But instead, I get the actual code and not the color text I want. Plus, the colors are backward. Purple sewer cleanout should match RBG color purple for when (DomainName($feature, 'Private') == "Yes") or else when it's "No", RBG color should be green. 

 

What am I doing wrong? 

 

Jen Zumbado-Hannibal, GISP
GIS Coordinator
City of Forest Grove
Forest Grove, OR 97116

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

What am I doing wrong?

Remove the commas inside the CLR tag.

 

the colors are backward

I don't know your data structure, but from the screenshot it seems to be correct? The purple asset has an AssetID (1295), so it shows as green text. The yellow assets have AssetID "PRVT", so the labels are purple.

Maybe try using the actual field values instead of the DomainName.


Have a great day!
Johannes

View solution in original post

2 Replies
JohannesLindner
MVP Frequent Contributor

What am I doing wrong?

Remove the commas inside the CLR tag.

 

the colors are backward

I don't know your data structure, but from the screenshot it seems to be correct? The purple asset has an AssetID (1295), so it shows as green text. The yellow assets have AssetID "PRVT", so the labels are purple.

Maybe try using the actual field values instead of the DomainName.


Have a great day!
Johannes
Jen_Zumbado-Hannibal
Frequent Contributor

Thanks @JohannesLindner . Eliminating the commas worked great! I also corrected the symbology to match the colors. I had it backwards. 

Thank you again! You saved me from banging my head against the wall 😉

Jen Zumbado-Hannibal, GISP
GIS Coordinator
City of Forest Grove
Forest Grove, OR 97116