Select to view content in your preferred language

How to select expression parser for labeling in arcpy.

577
2
01-18-2013 01:06 AM
VaL
by
Occasional Contributor
Hi all
I have a script which adds a layer file to an mxd, sets labels on and should label features with the first 10 characters of a attribute.
the labeling part is

[PHP]for i in ll.labelClasses:
   i.expression ="[FC_NAME] .substring(0,10)[/PHP]
 
This code sets the expression OK, I can see it in the FC properties (labels) manually in TOC. The problem is that the parser is set to VBScript, and the above expression is Jscript.

How do I set the parser in my code to be JScript?
0 Kudos
2 Replies
JeffMoulds
Esri Contributor
Arcpy doesnt have the label parser property exposed. So you will have to write the expression using whatever the parser is set to. If you set the parser in the UI to jscript for the map layer or lyr file, then you will be able to use a jscript expression. We have a enhancement in our system to expose this property which we are investigating for a future release. The tracking number is NIM085794. You can also add the suggestion to ideas.esri.com.
0 Kudos
curtvprice
MVP Alum
Arcpy doesnt have the label parser property exposed. So you will have to write the expression using whatever the parser is set to.  We have a enhancement in our system to expose this property which we are investigating for a future release. The tracking number is NIM085794. You can also add the suggestion to ideas.esri.com.


Vote it up!

Expose label expression language in arcpy.mapping Layer interface
https://c.na9.visual.force.com/apex/ideaView?id=087E00000004T7U&returnUrl=%2Fapex%2FideaList%3Fc%3D0...
0 Kudos