Creating a stack of labels within each feature of a layer

4779
4
Jump to solution
02-05-2016 01:04 PM
MarkLeander
New Contributor II

I have a layer of polygons that each have multiple attributes that I would like to label in a nicely organized stack within each polygon with each line in the stack consisting of two attributes. I've tried "fooling' (myself?) into the intended product by making multiple copies of the layer and labeling each attribute separately, but can't seem to effect the centered block of labels I'm seeking.  It seems likely that a pro would use a scripted (VBS? Python?) expression to create a single block of the labels for a single layer ... but I don't have scripting in my bag of tricks. I was successful in using the expression builder to put two labels on a single line ([Own1] &" "& [Asgnpct1]) but can't sort out how to add a 'return' to start the next line.

My problem is a little more involved than this, but I'm boldly confident that if someone has a script that can get me close, that I can figure it out.  Heck, maybe this is the little problem that will encourage to learn Python!

Thanks for any help you can offer...

0 Kudos
1 Solution

Accepted Solutions
KyleHeideman1
New Contributor II

If you leave the parser to VBscript which is the default in ArcMap you need to use vbnewline:

([Own1] & vbnewline & [Asgnpct1])

View solution in original post

4 Replies
KyleHeideman1
New Contributor II

If you leave the parser to VBscript which is the default in ArcMap you need to use vbnewline:

([Own1] & vbnewline & [Asgnpct1])

MarkLeander
New Contributor II

Thanks Kyle - we're on the right track. Can I include logic and formatting into the script?

For instance, can I bold one attribute?

Also, can I append each line onto the label block only if one attribute is non-zero? What I'm labeling is percent ownership of the polygon feature ... some polygons have one owner - others have more. A problem I am facing is that polygons with one owner have empty Own2, Own3, and Own4 in the attribute table, but Pct2, Pct3, Pct4 have 0 ownership percentages which are treated as labels anyway. In the clumsy approach I was taking before learning from you, I suppressed those labels using classes.

0 Kudos
DarrenWiens2
MVP Honored Contributor

Both logic and formatting are available for labels.

Logic: Label Expressions

Formatting: Formatting Tags

WesMiller
Regular Contributor III

The python version would be:

[Own1] + "\n" + [Asgnpct1]