<?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: Iterate Through Attribute Tables to Create Concatenated .csv File in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1016348#M1864</link>
    <description>&lt;P&gt;Thank you again.&amp;nbsp; I should have picked up on the need to make a new line but what do I know.&amp;nbsp; Very much appreciate your patience and help.&amp;nbsp; Be well.&amp;nbsp; Bill Cole&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jan 2021 14:29:37 GMT</pubDate>
    <dc:creator>WilliamCole</dc:creator>
    <dc:date>2021-01-13T14:29:37Z</dc:date>
    <item>
      <title>Iterate Through Attribute Tables to Create Concatenated .csv File</title>
      <link>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015731#M1852</link>
      <description>&lt;P&gt;This is for ArcGIS 10.8.1 and Python 2.7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using Blake Terhune’s solution [thank you, Blake] shown in the &lt;A href="https://community.esri.com/t5/python-questions/export-attribute-table-to-csv/td-p/254585" target="_blank" rel="noopener"&gt;ESRI Community article Export Attribute Table to .csv&lt;/A&gt; as a basis to create a .csv file from the selected contents of an attribute table, I need to go one step further and modify that script so that it will cycle through a defined number of Attribute Tables within a defined .gdb. [Leaving the changes out, the script works fine for a single FC.]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do that I made these changes, which, it appears, to have been wrong. Here’s the modified script with the modifications highlighted in yellow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Modified CSV Script" style="width: 907px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3592i73E623262DE3297F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-01-10_11-07-20.png" alt="Modified CSV Script" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Modified CSV Script&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I added line 12 which is intended to create a variable that extracts all FC’s that end with “03”.&lt;/P&gt;&lt;P&gt;2. Then modified line 15 so that that variable defined the array of input tables.&lt;/P&gt;&lt;P&gt;3. Finally added a for-loop as line 20 to cycle through those tables defined by line 15, outputting a – hopefully – concatenated .csv file containing all of the Attribute Table entries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This didn’t work as shown by this run-time result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ArcPy Error" style="width: 907px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3593i643232BAD76146D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-01-10_10-35-39.png" alt="ArcPy Error" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;ArcPy Error&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked to see if all the Fields defined in line 25 were spelled correctly – as I gotten a similar error when there was a problem with the field list – but they were all spelled and capitalized correctly. I would be grateful for some guidance on where I have gone wrong, please.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 20:58:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015731#M1852</guid>
      <dc:creator>WilliamCole</dc:creator>
      <dc:date>2021-01-11T20:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate Through Attribute Tables to Create Concatenated .csv File</title>
      <link>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015739#M1853</link>
      <description>&lt;P&gt;Without dissecting it, it seems to be nearly there.&lt;/P&gt;&lt;P&gt;I believe you have a bit of a mistake in trying to specify the path to the input table a bit too early on line 15.&amp;nbsp; What you're doing is trying to join the workspace to a list.&lt;/P&gt;&lt;P&gt;It could make sense if os.path.join was set up to take a list as an argument, but unfortunately it doesn't.&lt;/P&gt;&lt;P&gt;I would get rid of that and insert this after line 20:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for value in fclist:
    inputTable = os.path.join(workingGDB, value)
    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;effectively, during each iteration, the workingGDB path is joined to the FC name for each loop.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 21:16:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015739#M1853</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-11T21:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate Through Attribute Tables to Create Concatenated .csv File</title>
      <link>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015952#M1860</link>
      <description>&lt;P&gt;Mr. Pike, thank you very much for your input.&amp;nbsp; Obviously I still have much to learn about the Python/AcrPy world.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to make sure that I understood your suggestions, below is a modified script, hopefully reflecting the changes you offered.&amp;nbsp; Please let me know if I have made yet another mistake.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-01-12_9-58-26.png" style="width: 907px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3636i11993EFEB4AF074E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-01-12_9-58-26.png" alt="2021-01-12_9-58-26.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 15:22:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015952#M1860</guid>
      <dc:creator>WilliamCole</dc:creator>
      <dc:date>2021-01-12T15:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate Through Attribute Tables to Create Concatenated .csv File</title>
      <link>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015956#M1861</link>
      <description>&lt;P&gt;That would probably cause an unexpected indent error, you can do stuff on one line but not if you then indent it, and I wouldn't make it a habit even so as it's probably bad styling.&lt;/P&gt;&lt;P&gt;I'd also recommend adding the code via the syntax highlighter on the forum. click on the ellipsis '...' on the right hand side of the options, then insert/edit code sample - &amp;lt;/&amp;gt;&lt;BR /&gt;&lt;BR /&gt;this makes it much easier to read and adjust supplied code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i meant was:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for value in fclist:
    inputTable = os.path.join ....
    with open(outputCSV, 'w') as csvfile:
        csvwriter = .....&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Jan 2021 15:32:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1015956#M1861</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-12T15:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate Through Attribute Tables to Create Concatenated .csv File</title>
      <link>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1016348#M1864</link>
      <description>&lt;P&gt;Thank you again.&amp;nbsp; I should have picked up on the need to make a new line but what do I know.&amp;nbsp; Very much appreciate your patience and help.&amp;nbsp; Be well.&amp;nbsp; Bill Cole&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:29:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/iterate-through-attribute-tables-to-create/m-p/1016348#M1864</guid>
      <dc:creator>WilliamCole</dc:creator>
      <dc:date>2021-01-13T14:29:37Z</dc:date>
    </item>
  </channel>
</rss>

