Select to view content in your preferred language

Arcade Labelling expression Help

826
5
Jump to solution
11-28-2022 10:35 AM
WetlandMan
New Contributor III

Hi, I'm trying to generate a compound labelling expression where I have something like a town name, and then add in a second value followed by that value's label. I.e. I'd love for the label to read something like

Portland

5 d.u. / 1 acre

I've written my expression as $feature.Town + textformatting.newline + $feature.ZoningStrictness + "d.u./ 1 acre"

My labels are returning as:

Portland

5d.u./ 1 acre

If I change my expression to include: $feature.Town + textformatting.newline + $feature.ZoningStrictness + " " + "d.u./ 1 acre" (adding a space before the d.u./1 acre) it changes my expression to:

Portland

5

d.u./ 1 acre

 

Is there a way to add a space but not force a new line?

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

I'd check your label settings. If you aren't specifically asking for a line break but are getting one, I would guess that you have something in the label settings for wrapping on characters, or else having a character limit before wrapping to a new line.

What happens if you write the whole thing in a template literal instead?

`${$feature.Town}
${$feature.ZoningStrictness} d.u./ 1 acre`
- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

I'd check your label settings. If you aren't specifically asking for a line break but are getting one, I would guess that you have something in the label settings for wrapping on characters, or else having a character limit before wrapping to a new line.

What happens if you write the whole thing in a template literal instead?

`${$feature.Town}
${$feature.ZoningStrictness} d.u./ 1 acre`
- Josh Carlson
Kendall County GIS
0 Kudos
TylerT
by
Occasional Contributor III

You could try a non-breaking white space character also.  See https://en.wikipedia.org/wiki/Non-breaking_space.

Tyler

0 Kudos
WetlandMan
New Contributor III

Hmmm. I copy pasted your string and I got a break at the / so I believe it to be a text wrapping issue. 

0 Kudos
KenBuja
MVP Esteemed Contributor

Give template literals a try.

return `${$feature.Town}\n${$feature.ZoningStrictness} d.u. / 1 acre`
0 Kudos
WetlandMan
New Contributor III

I did use TylerT's suggestion but it turned out I had Stacking enabled which was casuing the issue it fixed as soon as I unchecked the box