Having trouble here: I'm trying to use python to write selective label expressions. I have several concentrations and depending on its "_Ex" number I either want it labeled red, not red, or not labeled at all. I have started with just one trying to set it to red. when i put this into the lable expression it says line one Findlabel not defined.
Any help would be appreciated. -Acrain (Indentations are not showing up correctly here, but I don't think thats my problem)
def FindLabel ([cis12DCE] , [cis12DCE_Ex]):
if short ( [cis12DCE_Ex] ) = 1:
return "<clr red = "255">"+"cis-1,2-Dichloroethylene "+[cis12DCE]+"</clr>
else:
return "cis-1,2-Dichloroethylene "+[cis12DCE]
Best Answer
I think there are a couple issues.
if
statement. Theif
statement needs to be on the next line.Edit - Change expression to double
==
sign, HT @HotpepperEdit 2 - I am including a screenshot of how the expression should be entered in the expression window. In addition, based on the error, I think you should simply try casting the field back to an integer
int
instead of usingshort
, as I'm not sure that is supported.For reference, here is the relevant ESRI Help document: Building Label Expressions
Try: