jlpersley

Is there a way to count the records in a feature layer?

Discussion created by jlpersley on Mar 26, 2012
Latest reply on Jun 30, 2015 by bixb0012
I need to display several layers from the same feature class using definition queries for different systems and using the same template for different projects. While I have created a script that can automatically produce these layers in an MXD, the definition query will often reduce number of records to zero for certain systems, eliminating the need for it as a layer. I would like to use an IF statement with arcpy.mapping.RemoveLayer to automatically remove those layers that do not return results, but not sure which functions may be able to do this. I have looked into using SearchCursor but do not otherwise know how to identify the number of records in the attribute database for a particular layer.

Outcomes