<?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: Combining muliple values into one cell (devided by comma, based on different attribute) in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/combining-muliple-values-into-one-cell-devided-by/m-p/1084820#M25734</link>
    <description>&lt;P&gt;this could be the solution (I believe it can be way shorter)&lt;/P&gt;&lt;P&gt;outDict = {}&lt;BR /&gt;columns = ['treeNumber', 'parcel']&lt;BR /&gt;curObj = arcpy.da.SearchCursor("tmpIntersect", columns) # tmpIntersect is original table&lt;BR /&gt;for row in curObj:&lt;BR /&gt;if row[0] in outDict:&lt;BR /&gt;outDict[row[0]].append(row[1])&lt;BR /&gt;else:&lt;BR /&gt;outDict[row[0]] = [row[1]]&lt;/P&gt;&lt;P&gt;arcpy.CreateTable_management(gdb, outputT)&lt;BR /&gt;arcpy.AddField_management(gdb+"\\"+outputT, "itemNumber", "SHORT")&lt;BR /&gt;arcpy.AddField_management(gdb+"\\"+outputT, "parcel", "TEXT")&lt;/P&gt;&lt;P&gt;rows = arcpy.InsertCursor(outputT, ["itemNumber","parcel"])&lt;BR /&gt;for x, y in outDict.items():&lt;BR /&gt;row = rows.newRow()&lt;BR /&gt;row.setValue("itemNumber",x)&lt;BR /&gt;row.setValue("parcel", ", ".join(y))&lt;BR /&gt;rows.insertRow(row)&lt;/P&gt;&lt;P&gt;arcpy.Delete_management(gdb+"\\tmpIntersect")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 08:41:32 GMT</pubDate>
    <dc:creator>TadeášDěd</dc:creator>
    <dc:date>2021-08-02T08:41:32Z</dc:date>
    <item>
      <title>Combining muliple values into one cell (devided by comma, based on different attribute)</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/combining-muliple-values-into-one-cell-devided-by/m-p/1083525#M25727</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a simple way in ArcGis Pro of combining multiple attribute1 values (with comma as a delimiter) into one cell based on attribute2 values. Here is a simple example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TadeDd_0-1627483055572.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19525i78A9CCD446412653/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TadeDd_0-1627483055572.png" alt="TadeDd_0-1627483055572.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As a result, I would like to get a table with two lines&lt;/P&gt;&lt;P&gt;attr2 | attr1&lt;/P&gt;&lt;P&gt;1 | "1"&lt;/P&gt;&lt;P&gt;2 | "2, 5"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help. I believe there is some very simple solution, but I did not find it &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best from&amp;nbsp;&lt;/P&gt;&lt;P&gt;T.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 14:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/combining-muliple-values-into-one-cell-devided-by/m-p/1083525#M25727</guid>
      <dc:creator>TadeášDěd</dc:creator>
      <dc:date>2021-07-28T14:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Combining muliple values into one cell (devided by comma, based on different attribute)</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/combining-muliple-values-into-one-cell-devided-by/m-p/1084820#M25734</link>
      <description>&lt;P&gt;this could be the solution (I believe it can be way shorter)&lt;/P&gt;&lt;P&gt;outDict = {}&lt;BR /&gt;columns = ['treeNumber', 'parcel']&lt;BR /&gt;curObj = arcpy.da.SearchCursor("tmpIntersect", columns) # tmpIntersect is original table&lt;BR /&gt;for row in curObj:&lt;BR /&gt;if row[0] in outDict:&lt;BR /&gt;outDict[row[0]].append(row[1])&lt;BR /&gt;else:&lt;BR /&gt;outDict[row[0]] = [row[1]]&lt;/P&gt;&lt;P&gt;arcpy.CreateTable_management(gdb, outputT)&lt;BR /&gt;arcpy.AddField_management(gdb+"\\"+outputT, "itemNumber", "SHORT")&lt;BR /&gt;arcpy.AddField_management(gdb+"\\"+outputT, "parcel", "TEXT")&lt;/P&gt;&lt;P&gt;rows = arcpy.InsertCursor(outputT, ["itemNumber","parcel"])&lt;BR /&gt;for x, y in outDict.items():&lt;BR /&gt;row = rows.newRow()&lt;BR /&gt;row.setValue("itemNumber",x)&lt;BR /&gt;row.setValue("parcel", ", ".join(y))&lt;BR /&gt;rows.insertRow(row)&lt;/P&gt;&lt;P&gt;arcpy.Delete_management(gdb+"\\tmpIntersect")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 08:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/combining-muliple-values-into-one-cell-devided-by/m-p/1084820#M25734</guid>
      <dc:creator>TadeášDěd</dc:creator>
      <dc:date>2021-08-02T08:41:32Z</dc:date>
    </item>
  </channel>
</rss>

