<?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: Concatenating multiple rows by common ID's in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002912#M34414</link>
    <description>&lt;P&gt;Thanks &lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/3374" target="_blank"&gt;@JoeBorgione&lt;/A&gt;&amp;nbsp;This looks like it might do the trick for me.&lt;/P&gt;&lt;P&gt;However, I've run the code and I keep getting:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 32, in &amp;lt;module&amp;gt;&lt;BR /&gt;RuntimeError: The row contains a bad value. [Description_field]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This field is a text field&amp;nbsp;@ 255. I'm not sure what makes a bad character in a text field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm confused?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you had this before?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Nov 2020 10:58:55 GMT</pubDate>
    <dc:creator>CliveCartwright</dc:creator>
    <dc:date>2020-11-19T10:58:55Z</dc:date>
    <item>
      <title>Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002651#M34388</link>
      <description>&lt;P&gt;I'm trying to concatenate an attribute from multiple records by the record's ID.&lt;/P&gt;&lt;P&gt;For example: The two descriptions for &lt;STRONG&gt;1&lt;/STRONG&gt;, and again for &lt;STRONG&gt;3&lt;/STRONG&gt;, added together as one record. (see below)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Concatenating the information associated with common ID's" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/476iA9D5A13D19DEB2FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="pivot.png" alt="Concatenating the information associated with common ID's" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Concatenating the information associated with common ID's&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset has over 2500 records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried using the Pivot tool, and I managed to get the ID numbers merged with their corresponding descriptions. but the descriptions were spread over 2500 fields. Way too many to concatenate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure I've seen this demonstrated in an Analysis MOOC, but I can't find it. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or ideas welcome.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:48:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002651#M34388</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2020-11-18T18:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002663#M34392</link>
      <description>&lt;P&gt;Is python an option for you?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 19:22:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002663#M34392</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-11-18T19:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002683#M34398</link>
      <description>&lt;P&gt;I agree with &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3374"&gt;@JoeBorgione&lt;/a&gt; that Python is really your best option, maybe your only option until Esri updates the Summary Statistics tool to include text concatenation.&lt;/P&gt;&lt;P&gt;Below is some code that should work for you in the interactive Python window, after you make the appropriate changes to tables and field names (make sure to backup table first!):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from collections import defaultdict

lyr = # name of layer in Pro map
flds = ["ID_FLD", "TXT_FLD"]
sql_orderby = "ORDER BY ID_FLD, TXT_FLD"

cat_txt = defaultdict(str)
with arcpy.da.UpdateCursor(lyr, flds, sql_clause=(None, sql_orderby)) as cur:
    id_prev, txt = next(cur)
    cat_txt[id_prev] = txt
    for id, txt in cur:
        if id == id_prev:
            cat_txt[id] += " " + txt
        else:
            cat_txt[id] = txt
        id_prev = id
        
    cur.reset()
    
    id_prev, txt = next(cur)
    cur.updateRow([id_prev, cat_txt[id_prev]])
    for id, txt in cur:
        if id == id_prev:
            cur.deleteRow()
        else:
            cur.updateRow([id, cat_txt[id]])
        id_prev = id&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 20:16:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002683#M34398</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-11-18T20:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002763#M34405</link>
      <description>&lt;P&gt;it could be. &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 22:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002763#M34405</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2020-11-18T22:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002764#M34406</link>
      <description>&lt;P&gt;Thanks, I'll give this a go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 22:36:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002764#M34406</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2020-11-18T22:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002912#M34414</link>
      <description>&lt;P&gt;Thanks &lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/3374" target="_blank"&gt;@JoeBorgione&lt;/A&gt;&amp;nbsp;This looks like it might do the trick for me.&lt;/P&gt;&lt;P&gt;However, I've run the code and I keep getting:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 32, in &amp;lt;module&amp;gt;&lt;BR /&gt;RuntimeError: The row contains a bad value. [Description_field]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This field is a text field&amp;nbsp;@ 255. I'm not sure what makes a bad character in a text field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm confused?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you had this before?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 10:58:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002912#M34414</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2020-11-19T10:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating multiple rows by common ID's</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002960#M34419</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/3374" target="_blank" rel="noopener"&gt;@JoeBorgione&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Sorted. I've managed to make it work.&lt;/P&gt;&lt;P&gt;I had to convert the ID number field into a text field; export the attribute table as a .csv, and export the csv version into the GDB. I guess a type of laundering for Arc to be able to read the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, a big Thank You for this. It's something I've wanted to be able to do for a long while. Thanks to your help I now can.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 14:25:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenating-multiple-rows-by-common-id-s/m-p/1002960#M34419</guid>
      <dc:creator>CliveCartwright</dc:creator>
      <dc:date>2020-11-19T14:25:01Z</dc:date>
    </item>
  </channel>
</rss>

