Select to view content in your preferred language

How to get count from selectlayerbyattribute

1495
2
Jump to solution
08-15-2014 12:14 PM
Hernando_CountyProperty_Apprai
Regular Contributor

I'm doing an arcpy.SelectLayerByAttribute_management and everything is working fine.  However I need to know if no records are selected so that I can handle that in my program.  If I do something like selCount = arcpy.SelectLayerByAttribute_management....  will that give me the selected count?  What if I wanted to iterate through each of the selected features?  How would I go about doing that?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

The help file contains a link to the GetCount Tool

"The Get Count tool can be used to determine the number of features or rows selected.  This can be especially useful in a script or model to determine if further processing is desired."

View solution in original post

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

The help file contains a link to the GetCount Tool

"The Get Count tool can be used to determine the number of features or rows selected.  This can be especially useful in a script or model to determine if further processing is desired."

0 Kudos
Hernando_CountyProperty_Apprai
Regular Contributor

Thanks Dan.  That worked perfectly!

0 Kudos