AnsweredAssumed Answered

Advanced label expression by arcpy

Question asked by cal.gis8086 on Dec 21, 2015
Latest reply on Dec 13, 2017 by rvburton

I would like to use arcpy to add a specific layer in mxd and automatically label the feature with different colors according to its attributes.

 

Even if I use the simple syntax lblClass.expression = "Function FindLabel ( [OBJECTID] ) FindLabel = [OBJECTID] End Function", label also cannot be shown. I search some papers about this and found that it may caused by "Advanced" setting on label expression. However, my layer is dynamically added in mxd but not pre-loaded in mxd.

 

Does anyone know,

1)  Can I label the feature with different colors according to its attributes if i don't turn on "Advanced" setting on label expression (dont use If-then)?

2)  How can I turn on the "Advanced" label expression by using arcpy? As I know, there is no property of labelClass to turn on the "Advanced" mode. Any other alternative methods to do so? I tried to use arcpy.mapping.UpdateLayer but "Advanced" label expression can not be updated by other layers which have set the "Advanced" option.

 

Thanks.

Outcomes