Select to view content in your preferred language

Programatically apply label to feature whose values are arcade scripts

638
2
Jump to solution
07-12-2021 04:38 PM
KhamilleJaynes
Emerging Contributor

I want to label my polygons by the field, here named field LABEL2. The values under LABEL2 are supposed to be arcade scripts. 

Ultimately my goal is to add line breaks to my labels. 

Inkedlabeling-issue-pro_LI.jpg

However, the way it shoes up in the Label Class dock pane isn't displaying the labels as I am expecting. (See photo above) 

I'm simply storing the "scripts" as string values for each row. (See photo below). 

labeling-issue-code.PNG

Bottom line: How can I programatically add line breaks to a label? I'm currently thinking that using Arcade scripts would be the answer, but is there a better way to do this? 

Thank you in advance.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

try this code change instead:

var finalValue = string.Empty;
foreach (string item in gradeRangeInfo)
{
  // change to your existing code is here:
  finalValue += System.Environment.NewLine + item;
}

View solution in original post

2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

try this code change instead:

var finalValue = string.Empty;
foreach (string item in gradeRangeInfo)
{
  // change to your existing code is here:
  finalValue += System.Environment.NewLine + item;
}
KhamilleJaynes
Emerging Contributor

This helped perfectly, thank you!

0 Kudos