arcpy.GetCount_management not working with queried tables

Discussion created by jesuspisto on Sep 17, 2013
Latest reply on Sep 17, 2013 by jesuspisto
Is anyone else having trouble with arcpy.GetCount_management using a queried table?

I have a table in my TOC (not a feature class) and then I apply a query as:

[INDENT]myTable.definitionQuery = "some query"[/INDENT]

Query works fine, but when I try getting the count of records in table as:

[INDENT]count = int(arcpy.GetCount_management(myTable).getOutput(0))[/INDENT]

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.

Just curious if anyone else had his problem. I worked around this by looping a cursor and counting the rows, so no big deal.