Select to view content in your preferred language

Stack Labels without Maplex

1996
4
07-07-2011 05:55 AM
MeganWilson_McClendon
New Contributor
I'm trying to stack a single field without using maplex (my company doesn't have the extension).   Any tips?

Thanks!
Tags (2)
0 Kudos
4 Replies
JimW1
by
Frequent Contributor
"& vbnewline &" still works in 10
0 Kudos
MeganWilson_McClendon
New Contributor
With a single attribute field?
0 Kudos
JimW1
by
Frequent Contributor
I figured it was more complicated...

This is crude:
Function FindLabel ( [NAME] )
label_string = [NAME] 
Left_Dash = instr(label_string , "-")
Right_Dash = instrRev(label_string , "-")
leftside = left( label_string, Left_Dash)
rightside = right(label_string, Right_Dash)
FindLabel = leftside & vbnewline & rightside
End Function


For this very specific example it finds the hypen in the NAME string "Ottawa - Gatineau" and returns each side on a different line. See Attached.

Depending on the complexity of your strings you'd likely have to throw a bunch of IF Statements to account for different combinations. It is doable but a bit tedius in VBScript. In a former role I labelled legal survey texts (1 attribute field) for parcels using a complex VBScript in the label parser engine and it was truly the last time I ever wanted to do this kind of work.

Another method is to export the attributes to excel or access and make new individual attributes for each part. You can than join the resulting table back to the spatial data and label mutli-line based on the join. This would be my preferred method now as VBScript is too needy.
0 Kudos
CoryMacNeil1
Frequent Contributor
Do an advanced label expression that splits your text by a space or other character.  Then use the "& vbnewline &", as mentioned previously, between each of the array elements from the split.

I hope this helps.
Cory
0 Kudos