We want to check if feature classes are empty in the ToolValidator.
When you call GetCount_managment() and background processing is on, there is a popup from our validation step.
Is there a different method to find if a feature class is empty, other than using GetCount_management?
Answer
Try a search cursor?
class ToolValidator:
def __init__(self):
import arcpy
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
fc = self.params[0]
rows = arcpy.SearchCursor(fc)
if rows.next(): #At least one feature
#Do something
else:
#Do something else
return
No comments:
Post a Comment