Select to view content in your preferred language

Adding and formatting multiple fields in a label

692
2
04-28-2022 01:49 PM
Labels (3)
CarbonAmerica
Occasional Contributor

Hey everyone,

I'm trying to create a label for water wells that contains the well name, date drilled, and measured depth. I've gotten them all to appear, but there are no spaces between them so it's formatted like namemeasuredepthm/d/yyy. Ideally, it would be good to either have it formatted like,

Name

Measured Depth

M/D/YY

Or

name, measured depth, m/d/yyyy

This is my current expression if that's helpful

$feature.Well_Name +""+
$feature.Max_MD +""+
Text($feature.Spud_Date, 'M/D/Y')

 

Thanks so much
0 Kudos
2 Replies
Robert_LeClair
Esri Notable Contributor

You're almost there!  Put a space in your "" - like this ", ". 

Or if you want them on a new line use arcade - $feature.Well_Name + TextFormatting.NewLine + $feature.Max_MD + TextFormatting.NewLine + Text($feature.Spud_Date, 'M/D/Y')

JohannesLindner
MVP Frequent Contributor

To make your expression easier to read, you can also use Concatenate:

var values = [
    $feature.Well_Name,
    $feature.Max_MD,
    Text($feature.Spud_Date, 'M/D/Y')
]
return Concatenate(values, TextFormatting.NewLine) // each on its own line
return Concatenate(values, ", ") // comma separated

Have a great day!
Johannes