Labael Expression --  carriage return proglem

7461
4
Jump to solution
06-12-2014 02:36 PM
CherylTrine
Occasional Contributor II
I am using ArcGIS 10.1  I have a several fields and strings I would like to use in a label expression and I would like it to start a newline part way through.  I have tried both with vbScript and Python, and when I verify it looks correct, but when I apply it to the map it is all on a single line.

Here is my vbScript form:

                  [NAME] &  " : "  &  [NUMBEROFFIBERS] + " Strand" & vbCrLf  & [FiberMode]

An example of the output is:
                 Cable 43 : 24 STRAND SINGLEMODE

I have also tried it using vbNewLine--it doesn't make any difference.  I have used the vbCrLf in maps I have created in the past and it has worked fine; this time I am using the ESRI Telecom Editing map template.  It looks like the template is using the Maplex labeling engine, but I'm not familiar with that.  Could there be some map or label setting that would prevent the use of a new line?

I also don't understand why "Strand" is in all caps in the output when that's not the way I put it in the script.

Cheryl
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RichardFairhurst
MVP Honored Contributor
Also, is it true that you can't use vbScript code such as "vbNewLine" or "vbCrLf" when using the Maplex label engine?


I already said I got it to observe the vbcrlf with Maplex, so it can do it.  However, I had the most basic settings on my layer with no "Contour" alignment.  Just the most vanilla placement style around the object.   I just had to uncheck the Stacked Labels option.  Maplex will override the vbcrlf with any number of settings, so it is a matter of experimentation.  Ultimately, you are the only one that can decide if it meets your requirements or not and there are so many options that it is hard to say what you should use.  Maplex is optional and for simplistic labels the standard label engine may be better, but once you set back to the standard label engine you may find that other labels no longer behave, since they may depend on Maplex to work.

View solution in original post

0 Kudos
4 Replies
T__WayneWhitley
Frequent Contributor
Sounds like something is turned on that is overriding your attempt to control it yourself...

It may be easier to use Maplex anyway--
http://resources.arcgis.com/en/help/main/10.1/index.html#/Introduction_to_the_Maplex_Label_Engine_tu...
0 Kudos
RichardFairhurst
MVP Honored Contributor
I am using ArcGIS 10.1  I have a several fields and strings I would like to use in a label expression and I would like it to start a newline part way through.  I have tried both with vbScript and Python, and when I verify it looks correct, but when I apply it to the map it is all on a single line.

Here is my vbScript form:

                  [NAME] &  " : "  &  [NUMBEROFFIBERS] + " Strand" & vbCrLf  & [FiberMode]

An example of the output is:
                 Cable 43 : 24 STRAND SINGLEMODE

I have also tried it using vbNewLine--it doesn't make any difference.  I have used the vbCrLf in maps I have created in the past and it has worked fine; this time I am using the ESRI Telecom Editing map template.  It looks like the template is using the Maplex labeling engine, but I'm not familiar with that.  Could there be some map or label setting that would prevent the use of a new line?

I also don't understand why "Strand" is in all caps in the output when that's not the way I put it in the script.

Cheryl


Only use the & not +.

[NAME] &  " : "  &  [NUMBEROFFIBERS] & " Strand" & vbCrLf  & [FiberMode]

Maplex would override the setting.  You may have Stack Labels checked,  which does its own wrapping logic.  If I uncheck that option the vbcrlf is observed.
0 Kudos
CherylTrine
Occasional Contributor II
Thanks, for the responses.  Unfortunately, they didn't solve the problem, but they did point me in a useful direction.

That stray "+" sign was the result of my having gone back and forth between using all "+'s" and all "&'s" in the statement.  It didn't make any difference.  Whether or not Stack Labels was checked or unchecked didn't make any difference, either.

As I suspected, there were some settings I did not know about that over-ride anything I do in the expression.  1st, the Label Styles was set to Small Caps (I hadn't realized that was possible--I haven't had a lot of experience with cartography!)  2nd, the map does use the Maplex Labels, so now I have had to dig in to learn what all it does. I started playing with "Stack Labels"; I tried to force a split by inserting a stacking character into the expression, making the maximum number of characters per line too short for everything to fit on one line, and checking "force split"; but none of that was honored. Next I played with "Label Position"; the map came with it set to "Contour", so I went through the various options and found that I could make "Regular" do what I wanted to do, so that's what I'm using. I wish I knew why they used "Contour" when making the TelecomEditing map template; I hope my change doesn't come back to bite me further down the road.

It appears to me that "Contour" doesn't honor stacking; is this true, or am I doing something wrong.  Also, is it true that you can't use vbScript code such as "vbNewLine" or "vbCrLf" when using the Maplex label engine?
0 Kudos
RichardFairhurst
MVP Honored Contributor
Also, is it true that you can't use vbScript code such as "vbNewLine" or "vbCrLf" when using the Maplex label engine?


I already said I got it to observe the vbcrlf with Maplex, so it can do it.  However, I had the most basic settings on my layer with no "Contour" alignment.  Just the most vanilla placement style around the object.   I just had to uncheck the Stacked Labels option.  Maplex will override the vbcrlf with any number of settings, so it is a matter of experimentation.  Ultimately, you are the only one that can decide if it meets your requirements or not and there are so many options that it is hard to say what you should use.  Maplex is optional and for simplistic labels the standard label engine may be better, but once you set back to the standard label engine you may find that other labels no longer behave, since they may depend on Maplex to work.
0 Kudos