<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Wrap/stack a text string label in an AGOL web map in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1140366#M44114</link>
    <description>&lt;P&gt;That code worked great in the new map viewer, thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 16:26:32 GMT</pubDate>
    <dc:creator>JayHodny</dc:creator>
    <dc:date>2022-02-03T16:26:32Z</dc:date>
    <item>
      <title>Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139525#M44071</link>
      <description>&lt;P&gt;Hello.&amp;nbsp; I have labels using an attribute text string that I would like to "wrap and stack" on my web map.&amp;nbsp; In Pro, I am able to do this using Labeling Properties (see screen shot).&amp;nbsp; I published the service but the labeling itself did not carry through to the service (maybe I missed a setting in the Share Web Layer?).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JayHodny_0-1643746462967.png" style="width: 495px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32868iFB71474BAFF876FB/image-dimensions/495x235?v=v2" width="495" height="235" role="button" title="JayHodny_0-1643746462967.png" alt="JayHodny_0-1643746462967.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I read that classic map viewer does not support the idea but the new map viewer does (maybe)?&amp;nbsp; I opened my web map in the new map viewer and poked around on the Label features dialogue but was not successful.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JayHodny_1-1643746906637.png" style="width: 556px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32869iF3716FF1A59C8EC8/image-dimensions/556x259?v=v2" width="556" height="259" role="button" title="JayHodny_1-1643746906637.png" alt="JayHodny_1-1643746906637.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am an Arcade beginner, but was wondering if there is an arcade function or code snippet available to do this, for example, wrap and stack the text string at the first space in the string?&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 20:23:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139525#M44071</guid>
      <dc:creator>JayHodny</dc:creator>
      <dc:date>2022-02-01T20:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139812#M44084</link>
      <description>&lt;P&gt;Yup it is supported in New Map Viewer. Here is a sample web map&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsapi.maps.arcgis.com/apps/mapviewer/index.html?webmap=a4e63c4987b543d790cd1f28b801cc3f" target="_blank"&gt;https://jsapi.maps.arcgis.com/apps/mapviewer/index.html?webmap=a4e63c4987b543d790cd1f28b801cc3f&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And an article on how to create this&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en/technical-article/000025694" target="_blank"&gt;https://support.esri.com/en/technical-article/000025694&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 14:10:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139812#M44084</guid>
      <dc:creator>RussRoberts</dc:creator>
      <dc:date>2022-02-02T14:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139948#M44088</link>
      <description>&lt;P&gt;Hello.&amp;nbsp; Many thanks for your reply.&amp;nbsp; &amp;nbsp;I had reviewed the article you refer too prior to my post.&amp;nbsp; If I am not mistaken, the workflow described therein is to stack values from multiple fields to create the feature labels using the new map viewer.&amp;nbsp; In my case, I have one field (screen shot) with text string choices that I want to split and stack or word-wrap and stack (I don't know of a better way to call this idea).&amp;nbsp; I will revisit the technical article in the case the answer does reside there.&amp;nbsp; Regards, Jay&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JayHodny_0-1643822732905.png" style="width: 316px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32954iCEC352DC566B0321/image-dimensions/316x500?v=v2" width="316" height="500" role="button" title="JayHodny_0-1643822732905.png" alt="JayHodny_0-1643822732905.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 17:26:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139948#M44088</guid>
      <dc:creator>JayHodny</dc:creator>
      <dc:date>2022-02-02T17:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139955#M44089</link>
      <description>&lt;P&gt;What you'd have to do is split the string and rebuild it with the line breaks&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var array = split($feature.yourField, " ");
var string;
for (var k in array){
    string += array[k] + TextFormatting.NewLine
}
return string;&lt;/LI-CODE&gt;&lt;P&gt;A more complex code will put line breaks at certain lengths (the variable maxlength)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var array = split($feature.yourfield, " ");
var string;
var line = "";
var maxlength = 10;
for (var k in array){
    console(count(array[k]))
    if (count(array[k]) &amp;lt;= maxlength) {
      if (count(line) &amp;lt;= maxlength) {
          line += array[k] + " ";
          if (count(line) &amp;gt; maxlength) {
            string += line + TextFormatting.NewLine;
            line = "";
          }
      } 
    } else {
        if (count(line) &amp;gt; 0) { 
          string += line + TextFormatting.NewLine + array[k] + TextFormatting.NewLine;
          line = "";        
        } else {
            string += array[k] + TextFormatting.NewLine;
        }
    }
}
if (count(line) != 0) string += line;
return string;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 17:38:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139955#M44089</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-02-02T17:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139962#M44090</link>
      <description>&lt;P&gt;Hi Ken,&amp;nbsp; Many thanks!&amp;nbsp; I was heading down the string split path, but my inexperience at Arcade was getting in the way.&amp;nbsp; Thanks for the code.&amp;nbsp; I will give this a try.&amp;nbsp; Regards, Jay&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 17:42:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1139962#M44090</guid>
      <dc:creator>JayHodny</dc:creator>
      <dc:date>2022-02-02T17:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1140366#M44114</link>
      <description>&lt;P&gt;That code worked great in the new map viewer, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 16:26:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1140366#M44114</guid>
      <dc:creator>JayHodny</dc:creator>
      <dc:date>2022-02-03T16:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1177625#M46195</link>
      <description>&lt;P&gt;Is it possible to create multiline labels in map viewer classic without using the split function?&lt;/P&gt;&lt;P&gt;I've launched the election solution which was created using map viewer classic. I would like to label my precincts by their number and name (i.e. Precinct 01 Cambell) with a line break after the number. My current arcade expression looks something like the following and returns a single line label:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var code = $feature.districtid;
if (code == '01'){
    return "Precinct 01" + TextFormatting.NewLine + "Cambell"
}
else if (code == '02'){....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 17:25:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1177625#M46195</guid>
      <dc:creator>SarahHartholt</dc:creator>
      <dc:date>2022-05-26T17:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1177653#M46196</link>
      <description>&lt;P&gt;Map Viewer Classic is based on JavaScript 3.x and TextFormatting.NewLine does not work in that version. Adding in a line break only works with the new Map Viewer since it is based on JavaScript 4.x which doesn't have that limitation.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 18:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1177653#M46196</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-05-26T18:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1214971#M48018</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know why stacking of labels doesn't work i Web AppBuilder eventhough it is set in ArcGIS Pro before publishing a feature service to ArcGIS Protal?&lt;/P&gt;&lt;P&gt;I have a long textfield that I for some features need stacking on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 08:34:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1214971#M48018</guid>
      <dc:creator>Lea_DyrholmHansen</dc:creator>
      <dc:date>2022-09-22T08:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1215155#M48027</link>
      <description>&lt;P&gt;Web AppBuilder is built on JavaScript 3.x, which cannot render line breaks in labels. You would have to use Experience Builder, which is built on JavaScript 4.x, to render the line breaks.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 16:08:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1215155#M48027</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-09-22T16:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1215437#M48035</link>
      <description>&lt;P&gt;Thanks, I will look forward to using Experience Builder. Our system is not ready for that yet.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 08:14:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1215437#M48035</guid>
      <dc:creator>Lea_DyrholmHansen</dc:creator>
      <dc:date>2022-09-23T08:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1228370#M48701</link>
      <description>&lt;P&gt;Hi Ken - Hopefully you can save me some time on a hopefully simple question.&amp;nbsp; Where do I apply that code?&amp;nbsp; I use Python a lot, not yet Java or JS, but I can read it.&amp;nbsp; Do you have any resources for applying this code to the same situation as the original Q poster -&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/264515"&gt;@JayHodny&lt;/a&gt;&amp;nbsp;?&amp;nbsp; I want to split the lines of labels for one Feature using your based on maxLength parameter.&amp;nbsp; I appreciate your help!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 15:43:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1228370#M48701</guid>
      <dc:creator>ZacharyUhlmann1</dc:creator>
      <dc:date>2022-11-03T15:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1228395#M48703</link>
      <description>&lt;P&gt;In the Map Viewer, click the Label icon on the right menu, then click Label. Click on "&amp;lt;/&amp;gt;" in the Label field to open the Arcade editor.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-11-03_12-18-19.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/55211iB09DEAC5DD98431C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2022-11-03_12-18-19.png" alt="2022-11-03_12-18-19.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 16:19:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1228395#M48703</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-11-03T16:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1395709#M58104</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;thanks for this expression. Could you please suggest for two or three different field expression in multiline.&lt;/P&gt;&lt;P&gt;Same like this type of expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 08:10:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1395709#M58104</guid>
      <dc:creator>sajjady</dc:creator>
      <dc:date>2024-03-14T08:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1396101#M58107</link>
      <description>&lt;P&gt;It would be helpful to start a new discussion and give more information on what you're trying to do.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 17:13:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1396101#M58107</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-03-14T17:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1397192#M58165</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp; Its really work but this expression is for only one field. I have three fields to lable for a polygon. Could you plese share your eperience how i can lable 3 fields with stack/wrap.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 12:22:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1397192#M58165</guid>
      <dc:creator>sajjady</dc:creator>
      <dc:date>2024-03-18T12:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1397265#M58169</link>
      <description>&lt;P&gt;You can always add more fields to a label string. This example uses &lt;A href="https://developers.arcgis.com/arcade/guide/template-literals/" target="_self"&gt;template literals&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var output = `${$feature.field1} and ${$feature.field2}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 14:36:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1397265#M58169</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-03-18T14:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1409359#M58619</link>
      <description>&lt;P&gt;Used the top code but doens't work when field has a list with Domain&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"Camper"&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DomainName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Camper"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;How do I update code?&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 13 Apr 2024 23:01:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1409359#M58619</guid>
      <dc:creator>JonathanHallam1</dc:creator>
      <dc:date>2024-04-13T23:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1416966#M58959</link>
      <description>&lt;P&gt;Thanks for these bits of code&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;, but I had a problem with the first example if the feature has a &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;lt;null&amp;gt;&lt;/FONT&gt;&lt;/STRONG&gt; value for the field I was trying to label with.&amp;nbsp; I modified the code to add an &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/FONT&gt; statement so that it only tries to add a new line if there is a value in the field:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var array = split($feature.yourField, " ");
var string;
if (Count(array)&amp;gt;1) {
  for (var k in array){
    if (count(array[k])&amp;gt;2){
      string += array[k] + TextFormatting.NewLine
    }
    else {
      string += array[k] +" ";
    }
  }
}
return string;&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;P&gt;The code above also includes a check on the length of each value in the array and only adds a new line if the word is &amp;gt;2 characters in length (e.g. so that single/two letter words are not split on to separate lines).&lt;/P&gt;&lt;P&gt;Just sharing so others don't have to spend ages trying to figure it out if they hit the same problem.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Apr 2024 12:05:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1416966#M58959</guid>
      <dc:creator>MappyIan</dc:creator>
      <dc:date>2024-04-30T12:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Wrap/stack a text string label in an AGOL web map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1521663#M60847</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;Is it possible to add left or right justify to your code?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 17:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/wrap-stack-a-text-string-label-in-an-agol-web-map/m-p/1521663#M60847</guid>
      <dc:creator>GreenInfoNetwork</dc:creator>
      <dc:date>2024-08-14T17:42:30Z</dc:date>
    </item>
  </channel>
</rss>

