<?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: Script to Create New Label by Deleting after a comma &amp;amp; Splitting into 2 lines in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500398#M6984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This may work, it will depend on how many names come before the comma.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should drop everything after the comma, then put the first two cities on top with the 3rd city beneath, if there are only two cities hyphenated, then it will stacked them one atop another.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" Split[1] 
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
&amp;nbsp; return expression
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make sure you use python and advanced expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately I have no data to test on but hopefully this does it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:58:33 GMT</pubDate>
    <dc:creator>IanMurray</dc:creator>
    <dc:date>2021-12-11T21:58:33Z</dc:date>
    <item>
      <title>Script to Create New Label by Deleting after a comma &amp;amp;amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500396#M6982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using the ESRI CBSA feature class, and the names are super long, for example: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anniston-Oxford-Jacksonville, AL Metropolitan Statistical Area&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want a VBscript or python script to use as a label expression to delete all words after the comma, and then stack the label into 2 lines, for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anniston-Oxford-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jackson&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 18:54:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500396#M6982</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T18:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500397#M6983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, but all that does is get rid of the comma and then stack the label. What I want to do is get rid of all the text after the comma (including the comma) and stack the label. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, if the name is "Atlanta-Sandy Springs-Roswell, GA Metropolitan Statistical Area"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to read something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Atlanta-Sandy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Springs-Rosewell&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 19:52:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500397#M6983</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T19:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500398#M6984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This may work, it will depend on how many names come before the comma.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should drop everything after the comma, then put the first two cities on top with the 3rd city beneath, if there are only two cities hyphenated, then it will stacked them one atop another.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" Split[1] 
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
&amp;nbsp; return expression
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make sure you use python and advanced expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately I have no data to test on but hopefully this does it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500398#M6984</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500399#M6985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for giving it a shot. Unfortunately, I get an error message: "The expression contains an error. Modify the expression and try again. Error 0 on line 0. SyntaxError: invalid syntax (&amp;lt;string&amp;gt;,line6)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the field name I'm working with is [name].&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't really care where the words get split up so long as it creates 2 lines (maybe so long as it gets split after the second word/name?) Also, some of the names have hyphens between each name and others not. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Albany-Schenectady-Troy, NY Metropolitan Statistical Area&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Virginia Beach-Norfolk-Newport News, VA-NC Metropolitan Statistical Area&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tampa-St. Petersburg-Clearwater, FL Metropolitan Statistical Area&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 20:21:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500399#M6985</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T20:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500400#M6986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Whoops left off a + sign&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1] 
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
&amp;nbsp; return expression

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GIve that a shot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500400#M6986</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500401#M6987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Still not working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See attached error msg&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 20:36:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500401#M6987</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T20:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500402#M6988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;lol this would be alot easier if I had the dataset and could debug myself.&amp;nbsp; I tend to make a few errors when writing scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I needed to put the return expression within the if/elif statement I believe&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1] 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500402#M6988</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500403#M6989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The result looks like this...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 20:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500403#M6989</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T20:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500404#M6990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was looking for a script that deletes all the info after the comma, and then splits the City name into 2 lines.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 20:51:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500404#M6990</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T20:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500405#M6991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;lol this would be alot easier if I had the dataset and could debug myself.&amp;nbsp; I tend to make a few errors when writing scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I needed to put the return expression within the if/elif statement I believe&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1] 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500405#M6991</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500406#M6992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Whoops left off a + sign&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1] 
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
&amp;nbsp; return expression

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;GIve that a shot.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi there - the results comes out empty &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500406#M6992</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2021-12-11T21:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500407#M6993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is some sample data to help out. Both of you are close, so hopefully this will help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 21:03:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500407#M6993</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T21:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500408#M6994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;from your reply, you didn't use my most recent script, or at least you didn't post it back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1] 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "-" + Split[1] + "- \n" + Split[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Also, the attribute table for that file was empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit Again: NVM, I didn't unzip properly&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500408#M6994</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500409#M6995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

def FindLabel ( [Name] ):
&amp;nbsp; Split = [Name].split(",")
&amp;nbsp; Split = Split[0] #drops everything after comma
&amp;nbsp; Split = Split.split("-") #splits by the hyphen
&amp;nbsp; if len(Split) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1] 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&amp;nbsp; elif len(Split) == 3:
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "-" + Split[1] + "- \n" + Split[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; return expression
&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; return Split[0]

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Likewise mine labelled all the samples.&amp;nbsp; It will only work if there are 3 or less cities names in the name field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I like yours Sol, except it splits single names in half, I think those ones would be fine on one line, but I guess its not my call.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33885[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500409#M6995</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500410#M6996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It worked for me with the sample data you sent.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ([NAME])
pos = instr([NAME],"," )
lab =&amp;nbsp; Left([NAME], pos - 1)
leng = len(lab)
half = Int(leng/2)
first = left(lab,half)
digits = leng-half
nex = right(lab,digits)
 FindLabel = first &amp;amp; vbnewline &amp;amp; nex
End Function&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks, Sol&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No - this was the result I got (see attached).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:58:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500410#M6996</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2021-12-11T21:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500411#M6997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE class="plain" name="code"&gt; def FindLabel ( [Name] ): &amp;nbsp; Split = [Name].split(",") &amp;nbsp; Split = Split[0] #drops everything after comma &amp;nbsp; Split = Split.split("-") #splits by the hyphen &amp;nbsp; if len(Split) == 2: &amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "- \n" + Split[1]&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return expression &amp;nbsp; elif len(Split) == 3: &amp;nbsp;&amp;nbsp;&amp;nbsp; expression = Split[0] + "-" + Split[1] + "- \n" + Split[2] &amp;nbsp;&amp;nbsp;&amp;nbsp; return expression &amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp; return Split[0] &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Likewise mine labelled all the samples.&amp;nbsp; It will only work if there are 3 or less cities names in the name field.&lt;BR /&gt;&lt;BR /&gt;I like yours Sol, except it splits single names in half, I think those ones would be fine on one line, but I guess its not my call.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually - I think this it! Looks like it works! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 21:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500411#M6997</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-16T21:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500412#M6998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yeah, I agree splitting the text in half like that is not really nice, but the OP said that it didn't matter so I didn't make it more complicated.&amp;nbsp; Plus I'm racing against you to figure it out. lol &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Plus I have to leave work now...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Haha, pretty much the same here.&amp;nbsp; From the two examples that were given I figured she wanted them to be split by the city names so thats what I went for.&amp;nbsp; Nothing wrong with yours, just a stylistic difference &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&amp;nbsp; Dang, she marked her quote of my response as answer, no answer provided for me &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 21:26:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500412#M6998</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-05-16T21:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Create New Label by Deleting after a comma &amp; Splitting into 2 lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500413#M6999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yours worked, it just wasn't quite stylistically what they wanted I suppose.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Go home and have a good night!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 21:33:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/script-to-create-new-label-by-deleting-after-a/m-p/500413#M6999</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-05-16T21:33:23Z</dc:date>
    </item>
  </channel>
</rss>

