Using Arcade Expression to change font size based on if statment

07-18-2019 09:13 AM
New Contributor III

I will confess that the most arcade I have ever used has been extremely simple. I currently have written a VBScript in ArcMap that will increase the font size and make it bold based on an if statement. I have tried several attempts to replicate this in Arcade, with no success.

Function FindLabel ( [GIS_ID_coded], [Pole_Inspection_status] )
dim a

a= [GIS_ID_coded]

if [Pole_Inspection_status] = "No" then

a= "<BOL><FNT size = '12'>" & a & "</FNT></BOL>"
end if

FindLabel = a

I haven't waded through all the arcade function references but have not been able to find any documentation on how to change font size and bold option. If anyone could point me in the right direction it would greatly appreciated! 

0 Kudos
2 Replies
Esri Regular Contributor

With Arcade you can do something like this:

If (Left($feature.STATE_NAME, 1) == "W")
return "<CLR red = '255'>" + $feature.STATE_NAME + "</CLR>";
return $feature.STATE_NAME

The formatting is documented here


0 Kudos
New Contributor III

Thanks for the link to the documentation. I used that in combination with the above code and was able to use the expression below to get what I needed. Thought I would post this in case anyone else had this kind of issue 

IIf($feature["Pole_Inspection_status"]==0,"<BOL><FNT size = '12'>" + $feature["GIS_ID_coded"] + "</FNT></BOL>",$feature["GIS_ID_coded"]);