AnsweredAssumed Answered

Translate python label expression to VB

Question asked by Caleb1987 on Jul 26, 2013
Latest reply on Sep 24, 2013 by thanos_cp78
First off, I'll admit I do not know much about VB.  A while back I found that there is a bug with exporting maps that have "advanced" python expressions to PDF programmatically (i.e. doing this through arcpy.mapping).  This is not a problem when using VB label expressions.  I have been trying (and failing) to convert the following Python label expression to VB.  This works inside ArcMap but the labels disappear when exported to PDF due to the bug.

def FindLabel ( [DEEDHOLDER] , [PID], [ACRES], [SUM_CSR_Potential], [AVE_CSR] ):   name = " ".join(str( [DEEDHOLDER] ).split(" ")[:5])   # grab only first few words on top line   name2 =  " ".join(str( [DEEDHOLDER] ).split(" ")[5:])  # grab the rest if there are more to wrap to next line   if len(name2) > 1:     name = "\n".join([name,name2])  # join name and name2 vars by a new line   pid =  [PID]    ac =  [ACRES] + " Ac"    sump = "CSR: "+ str(round(float([SUM_CSR_Potential]),1))   ave = "Ave: "+ [AVE_CSR]    return "\n".join([name,pid,ac,sump,ave]) 


This isn't too complicated in Python, but I am unable to successfully convert it to VB.  I would post my attempts at a VB solution, but I would rather save myself the embarrassment. 

If anyone can help, I would appreciate it!  Meanwhile, I will keep trying.

Outcomes