<?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: How to: Delete identical text after joining values in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164358#M54041</link>
    <description>&lt;P&gt;Since your input is a string, you first have to turn it into an array using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#split" target="_self"&gt;Split&lt;/A&gt; function. Then you can use the Distinct function. Finally, you have to turn that array back into a text string using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#concatenate" target="_self"&gt;Concatenate&lt;/A&gt; function.&lt;/P&gt;&lt;P&gt;This example also adds a test so that it ignores any Null strings. If that test is left off, the calculated field will contain an empty string instead of a Null.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (!IsEmpty($feature.Field)){
  var array = Split($feature.Field, ',');
  var array1 =  Distinct(array);
  return Concatenate(array1, ',')
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2022 12:40:57 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2022-04-14T12:40:57Z</dc:date>
    <item>
      <title>How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1163844#M53954</link>
      <description>&lt;P&gt;Hey Community,&lt;/P&gt;&lt;P&gt;after spatial join, is there a way to summarize the values in the text field for each row? E.g. from "1,1,2,2,3,1,2" to: "1,2,3"?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;-Felix&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2022-04-13 um 14.18.41.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38766i9F799D5AD29877B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2022-04-13 um 14.18.41.png" alt="Bildschirmfoto 2022-04-13 um 14.18.41.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 12:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1163844#M53954</guid>
      <dc:creator>FelixHGW</dc:creator>
      <dc:date>2022-04-13T12:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1163858#M53958</link>
      <description>&lt;P&gt;I think this should work if you use a python function (instead of print you'll want to use return.... I didn't have ArcPro available to test it so I used the python playground at W3Schools).&amp;nbsp; A little more python could sort the ouput:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;test = "1,2,2,1,3,3,3,3,4,5,1,5,10"
test2 = []
test3 = ""
z = 1
for x in test.split(","):
    test2.append(x)
myset = set(test2)
for y in myset:
  if z == 1:
    test3 = y
  else: 
    test3 = test3+","+y
  z = z + 1
print(test3)&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1649854998048.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38768i535A3D4A454B0023/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1649854998048.png" alt="KimGarbade_0-1649854998048.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 13:05:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1163858#M53958</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-13T13:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1163910#M53967</link>
      <description>&lt;P&gt;In Arcade, the &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#distinct" target="_self"&gt;Distinct&lt;/A&gt; function returns the unique values of an array&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Distinct([1,1,2,1,1,2,2,3,4,5])
// Returns [1,2,3,4,5]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:09:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1163910#M53967</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-04-13T14:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164324#M54032</link>
      <description>&lt;P&gt;Thanks! Normally it should work... .&lt;/P&gt;&lt;P&gt;But the Field Calculator cannot calculate any result. Both fields have the same format (Text). Any idea what I'm doing wrong?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2022-04-14 um 11.09.28.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38886i9519F2948C1542C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2022-04-14 um 11.09.28.png" alt="Bildschirmfoto 2022-04-14 um 11.09.28.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 09:13:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164324#M54032</guid>
      <dc:creator>FelixHGW</dc:creator>
      <dc:date>2022-04-14T09:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164358#M54041</link>
      <description>&lt;P&gt;Since your input is a string, you first have to turn it into an array using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#split" target="_self"&gt;Split&lt;/A&gt; function. Then you can use the Distinct function. Finally, you have to turn that array back into a text string using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#concatenate" target="_self"&gt;Concatenate&lt;/A&gt; function.&lt;/P&gt;&lt;P&gt;This example also adds a test so that it ignores any Null strings. If that test is left off, the calculated field will contain an empty string instead of a Null.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (!IsEmpty($feature.Field)){
  var array = Split($feature.Field, ',');
  var array1 =  Distinct(array);
  return Concatenate(array1, ',')
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 12:40:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164358#M54041</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-04-14T12:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164685#M54084</link>
      <description>&lt;P&gt;Ah, okay. Works perfect! Thank you. And when I want to sort these arrays, do I have to write the Sort.function before Return.function? (e.g:&amp;nbsp;&lt;STRONG&gt;return Concatenate(Sort(array1, ','&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;When I write it in the same line, there is an error called "Not callable value".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 08:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164685#M54084</guid>
      <dc:creator>FelixHGW</dc:creator>
      <dc:date>2022-04-15T08:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164696#M54085</link>
      <description>&lt;P&gt;The ',' is a parameter of the concatenate function, but the way you have it above your passing it to sort and sort doesn't know what to do with it. Try&lt;/P&gt;&lt;P&gt;return concatenate(Sort(array1),',')&lt;/P&gt;&lt;P&gt;This will sort your array values as strings (i.e. '1,10,11,2,3,33,4').&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 10:56:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164696#M54085</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-15T10:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164720#M54087</link>
      <description>&lt;P&gt;Great! Don't forget to click the "Accept as Solution" button&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 13:00:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164720#M54087</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-04-15T13:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164730#M54089</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;That return Concatenate made me think python MUST have something similar and sure enough... thank you for that:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;test = "1,2,2,1,3,3,3,3,4,5,1,5,10"
test2 = []
for x in test.split(","):
    test2.append(x)
myset = sorted(set(test2),key=int)
test = ','.join(myset)
print(test)

#returns  1,2,3,4,5,10
#String on numbers sorted as numbers &lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Apr 2022 14:09:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164730#M54089</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-15T14:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Delete identical text after joining values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164737#M54090</link>
      <description>&lt;P&gt;You can sort the array as numbers with this addition&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (!IsEmpty($feature.Field)){
  var array = Split($feature.Field, ',');
  var array1 = [];
  for (var k in array) {
    Push(array1, Number(array[k]));
  }
  return Concatenate(Distinct(Sort(array1)), ',')
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Apr 2022 14:30:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-delete-identical-text-after-joining-values/m-p/1164737#M54090</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-04-15T14:30:00Z</dc:date>
    </item>
  </channel>
</rss>

