jjacobson13

Labeling with Python

Discussion created by jjacobson13 on Jul 25, 2013
Latest reply on Jul 25, 2013 by rzufelt
I'm trying to label features as part of a python script and I'm running into two problems:

A. How do I turn on the 'Advance' option for expressions? lblClass.expression.advanced = True?

B. How do I drop down a line? I'm trying to write the following expression into the 'Expression' box:

lblClass.expression = ("Function FindLabel ( [TargetName], [Residual] )" + '\n'  + \
                              "    If [Residual] > 0 then" '\n' \
                              "      FindLabel = [TargetName] & vbnewline & '<CLR red='0' green='0' blue='255'>' & [Residual] & '</CLR>'" '\n' \
                              "    else" '\n' \
                              "      FindLabel = [TargetName] & vbnewline & '<CLR red='255' green='0' blue='0'>' & [Residual] & '</CLR>'" '\n'\
                              "    end if" '\n' \
                              "End Function")


I'm completely new to Python so I have no idea if I'm close or if it's even possible. Thanks

Outcomes