AnsweredAssumed Answered

Using if in Label Expression - Python

Question asked by mbly29 on Jan 3, 2013
Latest reply on Jan 9, 2013 by mbly29
Hi All,

I am trying to setup a label expression using python parser in ArcGIS 10.1. Simply, this expression looks at parcel attributes, and if the parcel size is >= 41, label it, otherwise, do not label. Also, if parcel meets requirement, split the string (ownername) at the comma and stack label, so last name on top, first name on bottom.

If the string does not contain a comma, stack at first space in string.

I have done part of this using VBscript parser, to the point where it splits at comma and stacks. I would like to move this over to a working python maintain consistency is scripting language that we use. I cannot get python to even look at the size of the parcel.

A working example of the VB is below:

Function FindLabel ( [ANAME], [ACRES] )
if ([ACRES] >= 41) Then
  myArray = Split ( [ANAME] , "," )
  strLabel = myArray (0)
  strname = Split ( [ANAME] , " " )
   For i = 1 To UBound (myArray)
   strLabel = strLabel & "," & vbNewLine & myArray (i)  
   FindLabel = strLabel
End if
End Function