<?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: VB Script Labeling for Attributes in One Field - how to stack and truncate labels in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709739#M9586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi rfairhur24 - thanks for the post reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to copy and paste the code into the expression window under the Labels tab, but I get an error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"The expression contains an error.... Error 8 on line 35. Cannot use parentheses when calling a Sub."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, just to be clear, the field I'm using for the labels looks something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]26782[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much for your input!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Aug 2013 01:42:21 GMT</pubDate>
    <dc:creator>TiaMorita</dc:creator>
    <dc:date>2013-08-19T01:42:21Z</dc:date>
    <item>
      <title>VB Script Labeling for Attributes in One Field - how to stack and truncate labels?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709737#M9584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a shapefile with a field I am using for labels. The attributes in this field are long company names. I will be publishing the contents of this map to ArcGIS Portal as a map service too, so I want to clean up my labels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First, I'd like to stack the labels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Second, I would like to truncate them by replacing common words in all these company names (eg. replace Company with "Co.", Beverage with "Bev.", Distributing with "Dist.", and so on...)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a single script where I can accomplish both?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Aug 2013 21:33:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709737#M9584</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2013-08-18T21:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709738#M9585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a shapefile with a field I am using for labels. The attributes in this field are long company names. I will be publishing the contents of this map to ArcGIS Portal as a map service too, so I want to clean up my labels.&lt;BR /&gt;&lt;BR /&gt;First, I'd like to stack the labels.&lt;BR /&gt;Second, I would like to truncate them by replacing common words in all these company names (eg. replace Company with "Co.", Beverage with "Bev.", Distributing with "Dist.", and so on...)&lt;BR /&gt;&lt;BR /&gt;Is there a single script where I can accomplish both?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my suggested code assuming you have multiple company names separated by commas that you want to stack:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel([COMPANY_NAMES])

&amp;nbsp; Dim MyArray, i, names
&amp;nbsp; MyArray = Split([COMPANY_NAMES], ",")

&amp;nbsp; For i = 0 to UBound(MyArray)
&amp;nbsp;&amp;nbsp;&amp;nbsp; If i = 0 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; names = MyArray(i) ' Begin a single company.
&amp;nbsp;&amp;nbsp;&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; names = names &amp;amp; vbCrLf &amp;amp; MyArray(i) ' Insert a new line after every company name.
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; Next
&amp;nbsp; Replace(names, "Limited Liability Company", "LLC")
&amp;nbsp; Replace(names, "Company", "Co")
&amp;nbsp; Replace(names, "Beverage", "Bev")
&amp;nbsp; Replace(names, "Distributed", "Dist")
&amp;nbsp; FindLabel = names
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709738#M9585</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-12T06:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709739#M9586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi rfairhur24 - thanks for the post reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to copy and paste the code into the expression window under the Labels tab, but I get an error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"The expression contains an error.... Error 8 on line 35. Cannot use parentheses when calling a Sub."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, just to be clear, the field I'm using for the labels looks something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]26782[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much for your input!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 01:42:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709739#M9586</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2013-08-19T01:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709740#M9587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi rfairhur24 - thanks for the post reply.&lt;BR /&gt;&lt;BR /&gt;I tried to copy and paste the code into the expression window under the Labels tab, but I get an error message:&lt;BR /&gt;"The expression contains an error.... Error 8 on line 35. Cannot use parentheses when calling a Sub."&lt;BR /&gt;&lt;BR /&gt;Also, just to be clear, the field I'm using for the labels looks something like this:&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]26782[/ATTACH]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks so much for your input!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I edited the expression a little, but the error makes little sense, since there is no line 35 in my code and none of the functions I am using are Subs.&amp;nbsp; So the error is probably coming from an actual field value processing thought the internal code of the Replace expression, the Split or the array.&amp;nbsp; Please put a definition query on the layer to just label a single record (the one you showed) and repaste the expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, what is the actual name of the field that contains the company names?&amp;nbsp; How are the names stored in the field?&amp;nbsp; Does it already contain the newlines like your example showed, or did you add those?&amp;nbsp; What type is the field?&amp;nbsp; Is it a text field and less than 256 characters or is it another field type?&amp;nbsp; I am operating in the dark at this point, since I really don't know what your set up is.&amp;nbsp; I really need to know the field configuration in its raw form.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 02:21:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709740#M9587</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-08-19T02:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709741#M9588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my polygon shapefile, the field name is "dist_name" (for Distributor Name). It is a text field with a limit of 50. Null values are allowed in this field (although there are none). Each row is a unique distributor name. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you think the issue could be if there are any other punctuation marks in the company names? For instance, a company name in this field might look like this: B &amp;amp; K Distributing, or "Northwest Colorado Beverage - PM".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry I did not provide more info before... I did try using the expression on just one record, but I got the same error message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 02:42:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709741#M9588</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2013-08-19T02:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709742#M9589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just thinking of the easiest way to tackle this... Would it be easier to just loop through all the names in this one "dist_name" field and every time a particular word comes up, replace it with a truncated version to shorten my labels? Eg: everytime "Distributing" comes up, replace it with "Dist."; everytime "Beverage" comes up, replace it with "Bev."; everytime "Company" comes up, replace it with "Co."? Would that be possible?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 03:12:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709742#M9589</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2013-08-19T03:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709743#M9590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Null values do matter and would cause an error, so I would have had to add a test for that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the expression does not stack multiple rows.&amp;nbsp; There is no label expression that will do that without using Python and a cursor, and I not totally certain even that will work.&amp;nbsp; I would have to look for some code to convert to Python, since I am not a user of that language normally.&amp;nbsp; So no point working out the VB script issues anymore.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something for another day and possibly another Python user, but multi-row labels have come up repeatedly on the forums and I do not think anyone has come up with a solution since the VB6 label stacker routine stopped working off the user script page (and that was with a related table, not multiple rows in a single table).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are the records that would stack related by any attributes or would they only stack due to some kind of proximity analysis?&amp;nbsp; No one has done any proximity based labeling code that I have seen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your question now goes way beyond Cartography and should be reposted on the Python forum with a much clearer description of your set up and requirements.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 04:17:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709743#M9590</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-08-19T04:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709744#M9591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Edit:&amp;nbsp; I found the error in my code.&amp;nbsp; I have to assign the replace output back to the name variable as shown below.&amp;nbsp; Normally I use this in the Field Calculator and don't have to do that step, but it is required in a label expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just for the sake of trying it, use this code.&amp;nbsp; It will do nothing to stack your labels, but it should do the word replacements without error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel([dist_name])
&amp;nbsp; Dim name
&amp;nbsp; If IsNull([dist_name]) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ""
&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Add as many replace expressions as you need.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The first string in the pair must match your input exactly to be replaced.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The order of replace statements matters.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Words that can be part of other replaced words must come last.
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = [dist_name]
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Limited Liability Company", "LLC")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Company", "Co")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Beverage", "Bev")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Distributed", "Dist")
&amp;nbsp; End if
&amp;nbsp; FindLabel = name
End Function&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you did the edits to the fields with the field calculator you would use the Replace expression anyway, i.e.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Replace([dist_name], "Company", "Co")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So that statement will work unless there is something very strange in your field that I have never encountered before (none of the characters you mentioned would be special or trigger an error).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only character that would throw an error in your company names that I know of is a double quote (").&amp;nbsp; Do you have that character in any actual company name?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709744#M9591</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-12T06:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709745#M9592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;rfairhur24 - THANKS! This works just great and helps me to simplify/truncate my labels.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 13:57:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709745#M9592</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2013-08-19T13:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709746#M9593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Edit:&amp;nbsp; I found the error in my code.&amp;nbsp; I have to assign the replace output back to the name variable as shown below.&amp;nbsp; Normally I use this in the Field Calculator and don't have to do that step, but it is required in a label expression.&lt;BR /&gt;&lt;BR /&gt;Just for the sake of trying it, use this code.&amp;nbsp; It will do nothing to stack your labels, but it should do the word replacements without error:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel([dist_name])
&amp;nbsp; Dim name
&amp;nbsp; If IsNull([dist_name]) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ""
&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Add as many replace expressions as you need.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The first string in the pair must match your input exactly to be replaced.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The order of replace statements matters.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Words that can be part of other replaced words must come last.
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = [dist_name]
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Limited Liability Company", "LLC")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Company", "Co")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Beverage", "Bev")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Distributed", "Dist")
&amp;nbsp; End if
&amp;nbsp; FindLabel = name
End Function&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;If you did the edits to the fields with the field calculator you would use the Replace expression anyway, i.e.:&lt;BR /&gt;&lt;BR /&gt;Replace([dist_name], "Company", "Co")&lt;BR /&gt;&lt;BR /&gt;So that statement will work unless there is something very strange in your field that I have never encountered before (none of the characters you mentioned would be special or trigger an error).&lt;BR /&gt;&lt;BR /&gt;The only character that would throw an error in your company names that I know of is a double quote (").&amp;nbsp; Do you have that character in any actual company name?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;--------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rfairhur24,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much for your earlier help. This script has been working great! Just curious if there's a way to update it so it stacks my lllabels after the first word. For instance, if the company name is "Pacific Beverage Company", the script would still replace "Company" with "Co.", but stack the label where Beverage Company comes as a single line under Pacific. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tiamo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:25:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709746#M9593</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2021-12-12T06:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: VB Script Labeling for Attributes in One Field - how to stack and truncate labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709747#M9594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;--------------&lt;BR /&gt;rfairhur24,&lt;BR /&gt;&lt;BR /&gt;Thanks so much for your earlier help. This script has been working great! Just curious if there's a way to update it so it stacks my lllabels after the first word. For instance, if the company name is "Pacific Beverage Company", the script would still replace "Company" with "Co.", but stack the label where Beverage Company comes as a single line under Pacific. &lt;BR /&gt;&lt;BR /&gt;Thanks for your help,&lt;BR /&gt;tiamo&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel([dist_name])
&amp;nbsp; Dim name
&amp;nbsp; If IsNull([dist_name]) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ""
&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Add as many replace expressions as you need.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The first string in the pair must match your input exactly to be replaced.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The order of replace statements matters.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Words that can be part of other replaced words must come last.
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = [dist_name]
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, " ", vbNewLine, 1, 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Limited Liability Company", "LLC")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Company", "Co")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Beverage", "Bev")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Replace(name, "Distributed", "Dist")
&amp;nbsp; End if
&amp;nbsp; FindLabel = name
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-script-labeling-for-attributes-in-one-field-how/m-p/709747#M9594</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-12T06:25:53Z</dc:date>
    </item>
  </channel>
</rss>

