<?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 GetCount_management &amp; InsertCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230805#M17880</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;#This scrip is working to a point, but is not what I expected. If Someone could help me with this,&lt;BR /&gt;#it would be greatly appricated.......Thank You in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#The GetCount_management "COUNT" for the wHydrant Feature Class is 4457.&lt;BR /&gt;#After running the script, the result is four separtate rows in one column. See attached.&lt;BR /&gt;#My expectation is only one row and one column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;lyrfile ="C:\\Projects\\DavidSchultise_Southwest_GIs\\SouthwestTesting.gdb\\HydrantTesting\\wHydrant"&lt;BR /&gt;result = arcpy.GetCount_management(lyrfile)&lt;BR /&gt;print('{} has {} records'.format(lyrfile, result[0]))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#My Table&lt;BR /&gt;fc ="C:\\Projects\\DavidSchultise_Southwest_GIs\\Testing.dbf"&lt;/P&gt;&lt;P&gt;for row in (result[0]):&lt;BR /&gt; cursor = arcpy.da.InsertCursor(fc, ["NUMBER"])&lt;BR /&gt; cursor.insertRow(row[0])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jan 2018 21:10:04 GMT</pubDate>
    <dc:creator>LarryAdgate</dc:creator>
    <dc:date>2018-01-22T21:10:04Z</dc:date>
    <item>
      <title>GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230805#M17880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;#This scrip is working to a point, but is not what I expected. If Someone could help me with this,&lt;BR /&gt;#it would be greatly appricated.......Thank You in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#The GetCount_management "COUNT" for the wHydrant Feature Class is 4457.&lt;BR /&gt;#After running the script, the result is four separtate rows in one column. See attached.&lt;BR /&gt;#My expectation is only one row and one column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;lyrfile ="C:\\Projects\\DavidSchultise_Southwest_GIs\\SouthwestTesting.gdb\\HydrantTesting\\wHydrant"&lt;BR /&gt;result = arcpy.GetCount_management(lyrfile)&lt;BR /&gt;print('{} has {} records'.format(lyrfile, result[0]))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#My Table&lt;BR /&gt;fc ="C:\\Projects\\DavidSchultise_Southwest_GIs\\Testing.dbf"&lt;/P&gt;&lt;P&gt;for row in (result[0]):&lt;BR /&gt; cursor = arcpy.da.InsertCursor(fc, ["NUMBER"])&lt;BR /&gt; cursor.insertRow(row[0])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:10:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230805#M17880</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2018-01-22T21:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230806#M17881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm, can you just use the below snippet for your count?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrfile&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&amp;nbsp; ‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:17:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230806#M17881</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2018-01-22T21:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230807#M17882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I apologize, I forgot to add that eventually I need to loop through aprox four hundred features classes for an inventory project..............Thank You&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:30:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230807#M17882</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2018-01-22T21:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230808#M17883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, for the issue at hand with it printing over multiple rows, running this doesn't work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

lyrfile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:\\Projects\\DavidSchultise_Southwest_GIs\\SouthwestTesting.gdb\\HydrantTesting\\wHydrant"&lt;/SPAN&gt;
fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:\\Projects\\DavidSchultise_Southwest_GIs\\Testing.dbf"&lt;/SPAN&gt;

result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrfile&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;InsertCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NUMBER"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;result&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:12:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230808#M17883</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2021-12-11T11:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230809#M17884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Regarding the fc loop, let us know if you encounter any issues! Are they all in the same gdb?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 22:13:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230809#M17884</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2018-01-22T22:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230810#M17885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are a very large Public Water Utility Company with over&amp;nbsp;thirty eight Geodatabases and our asset&amp;nbsp;management &amp;nbsp;group requires&amp;nbsp;an inventory of all their assets. It will be a&amp;nbsp;challenge looping through all of them and&amp;nbsp;with a little help I will&amp;nbsp;get there..................Thank you for checking back with me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Larry&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 22:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230810#M17885</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2018-01-22T22:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: GetCount_management &amp; InsertCursor</title>
      <link>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230811#M17886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Larry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's a discussion on StackExchange (GIS) that might help you down that path, no pun intended -&amp;nbsp;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/59350/listing-feature-classes-of-multiple-geodatabase-in-multiple-folder" title="https://gis.stackexchange.com/questions/59350/listing-feature-classes-of-multiple-geodatabase-in-multiple-folder"&gt;arcpy - Listing Feature Classes of Multiple geodatabase in Multiple Folder? - Geographic Information Systems Stack Excha…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2018 14:09:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getcount-management-insertcursor/m-p/230811#M17886</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2018-01-23T14:09:37Z</dc:date>
    </item>
  </channel>
</rss>

