use vbscript with carriage return

1113
4
05-10-2023 11:21 AM
Labels (1)
PLadd
by
Occasional Contributor III

(do others get tired of having to google every issue in ArcGIS Pro? Man, it's exhausing!)

Today's issue is that I am writing a label expression in ArcGIS Pro using VBScript.  I want to use a carriage return (or new line feed or whatever we're calling it) but the following do not work:

[map_label] & vbcr & [start_even]

[map_label] & vbcrlf & [start_even]

Also tried: $feature.map_label + "/n" + $feature.start_even

And: $feature.map_label + TextFormatting.NewLine + $feature.start_even

The expression check is valid.  I'm using Pro 2.9.5.

Everything stays on the same line as seen below.  HELP!

PLadd_0-1683742479941.png

 

0 Kudos
4 Replies
SteveCole
Frequent Contributor

How about vbNewLine?..

0 Kudos
PLadd
by
Occasional Contributor III

Strange - it's an improvement but certainly not doing what I've told it to do:

Here's the expression:

[map_label] & vbNewLine & [start_even] & vbNewLine & [start_odd] & vbNewLine & [end_even] & vbNewLine & [end_odd]

And here's the result (hope you can see that the see that map_label is on one line and all of the house numbers are on the second line - instead of on their own lines per the expression above).

PLadd_0-1683746503913.png

 

0 Kudos
PLadd
by
Occasional Contributor III

And it's not just in VBScript.  This is Arcade with the same results:

$feature.map_label + TextFormatting.NewLine + $feature.start_even +  TextFormatting.NewLine + $feature.start_odd +  TextFormatting.NewLine + $feature.end_even +  $feature.end_odd

0 Kudos
JesseWickizer
Esri Contributor

It looks like you may be using Street placement style. Maplex Label Engine uses special stacking rules for street  placement. Maplex controls where to stack the label and has limits of how many stacked lines are possible. Furthermore, when labeling with the Street placement style, labels have a limit of six words. If there are more than six, the label is not placed so if any of the street names have more than 2 words your labels will go unplaced because the total label will exceed 6 words with all those fields combined in your example.

If you change to Regular placement you should be able to achieve the specific stacking you're looking for.