How to include a Carriage Return or NewLine into an ARCADE Label expression?

401
4
02-21-2021 06:56 PM
Labels (1)
LeandraGordon
Occasional Contributor

How can I insert newline characters in an Arcade expression in ArcGIS Enterprise, the following:

'Rural SI VBP: ' +$feature.AllData_Rural_Site_Influences__VBP_
+ textformatting.NewLine
+ ' SI Non VBP: ' +$feature.AllData_Site_Influences__Non_VBP_
+ textformatting.newline

seems to be ignored in ArcGIS Enterprise. 
The inital maps are being prepared in ArcGIS Pro 2.4 so if there is a way we could do this there and have the labels show up in Portal that would work for us too.

I understand from previous questions that textformatting.NewLine isn't supported? But it is included in the documentation here: https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/text-formatting-tags.htm

This is how it looks for us currently in Mapinfo:

LeandraGordon_0-1613962360841.png

 

Tags (3)
4 Replies
ManishPatel
Esri Contributor

Hi @LeandraGordon ,

 

TextFormatting.NewLine this should work, I just tried and it works for me. You might want to check from the list of the constant functions and test it.

Cheers,
Manish
LeandraGordon
Occasional Contributor

Hi Manish - what version of ArcGIS Pro and Portal are you using?

0 Kudos
jcarlson
Regular Contributor II

If you are rendering your label in a JS 3.x map (like the current Map Viewer), TextFormatting.NewLine and "\n" are both ignored.

In a JS 4.x (Map Viewer Beta, certain Configurable Apps), both are valid ways of adding a new line.

Here's a layer of ours with multiline labels, first in a JS 3.x map:

jcarlson_1-1614000666436.png

And then in JS 4.x:

jcarlson_2-1614000773967.png

 

What version of Portal are you on? If you're at 10.8 or later, you can also create Hosted Map Image Layers that can take advantage of all the advanced labeling and symbology of Pro, but are based on a hosted feature layer. Works just the same in either map viewer, too.

- Josh Carlson
Kendall County GIS
LeandraGordon
Occasional Contributor

Hi Josh,

Hosted Map Image Layers won't work for us as we are creating ArcGIS Pro maps on the fly from excel and loading them into ArcGIS Enterprise as Individual Map Image Layers. We create a couple a day during our peak season as the maps are used as an Audit tool for our data.
The problem starts in ArcGIS Pro when TextFormatting.NewLine is ignored.
Note that I've found some other info here: https://community.esri.com/t5/developers-questions/arcade-text-constant-for-textformatting-newline-i...

0 Kudos