<?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: arcpy.GetCount_management not working with queried tables in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117675#M9237</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I too get this behaviour. I get around it by creating the table view in this manner.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.MakeTableView_management(data, table, 'OBJECTID &amp;lt; 100')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As opposed to this, if this is how you are doing it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;table = arcpy.MakeTableView_management(data)
table.definitionQuery = 'OBJECTID &amp;lt; 100'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:54:20 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2021-12-11T06:54:20Z</dc:date>
    <item>
      <title>arcpy.GetCount_management not working with queried tables</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117674#M9236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is anyone else having trouble with arcpy.GetCount_management using a queried table?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a table in my TOC (not a feature class) and then I apply a query as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;[INDENT]myTable.definitionQuery = "some query"[/INDENT]&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Query works fine, but when I try getting the count of records in table as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;[INDENT]count = int(arcpy.GetCount_management(myTable).getOutput(0))[/INDENT]&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result is the total number of rows before the query. If I do the same thing with a feature class it works fine. I'm running this in a simple stand alone script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just curious if anyone else had his problem. I worked around this by looping a cursor and counting the rows, so no big deal.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Sep 2013 20:36:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117674#M9236</guid>
      <dc:creator>JuanOrozco</dc:creator>
      <dc:date>2013-09-17T20:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.GetCount_management not working with queried tables</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117675#M9237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I too get this behaviour. I get around it by creating the table view in this manner.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.MakeTableView_management(data, table, 'OBJECTID &amp;lt; 100')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As opposed to this, if this is how you are doing it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;table = arcpy.MakeTableView_management(data)
table.definitionQuery = 'OBJECTID &amp;lt; 100'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:54:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117675#M9237</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T06:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.GetCount_management not working with queried tables</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117676#M9238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I too get this behaviour. I get around it by creating the table view in this manner.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.MakeTableView_management(data, table, 'OBJECTID &amp;lt; 100')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;As opposed to this, if this is how you are doing it.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;table = arcpy.MakeTableView_management(data)
table.definitionQuery = 'OBJECTID &amp;lt; 100'&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You're right, I was getting my table like that. I will start doing it as you do it. Thank you so much.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:54:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-getcount-management-not-working-with-queried/m-p/117676#M9238</guid>
      <dc:creator>JuanOrozco</dc:creator>
      <dc:date>2021-12-11T06:54:23Z</dc:date>
    </item>
  </channel>
</rss>

