I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using Python's triple quote technique for multilines but that only seperates each line with a tab in the expression window. Anyone know of a way to do this? If so, does the label class need to be set to 'advanced' first, or is it possible to automate this aspect as well?
Alternatively, loading in precreated expression files would work just as well if not better if this is possible to script.
This is with the use of the Maplex extension.
EDIT
Basically this code below needs to be pasted into the expression box with Arcpy. One line works just fine, but because there are multiple lines, I can't get it to paste it properly.
Function FindLabel ( [SUPP_NO], [SUPP_SUFF])
IF [SUPP_SUFF] = "000" THEN
FindLabel = "#" & [SUPP_NO] & VBNewLine & [Fuse_Count]"
2 Answers 2
You need to add an EndIf to your function and you must have the [Fuse_Count] in your first line. Give this a try:
Function FindLabel ( [SUPP_NO], [SUPP_SUFF], [FUSE_COUNT] )
if [SUPP_SUFF] = "000" then
FindLabel = "#" & [SUPP_NO] & vbnewline & [FUSE_COUNT]
end if
End Function
-
I just posted a snippet above. I confirmed with ESRI support that there is no way to enable the 'Advanced' tick box from Arcpy. Since this can not be enabled in code, advanced expressions can't be entered from Arcpy.amasephy– amasephy2014年02月21日 12:50:17 +00:00Commented Feb 21, 2014 at 12:50
Function FindLabel ( [No], [Instructio] , [Y], [X] )
FindLabel = [No] &vbnewline & " " & [Instructio] &vbnewline & "Y " & [Y] & " X " & [X]
End Function
\r\n
at the desired line breaks in the expression string?