Hi
I use "Copy Features" tool to make a layer from selection. It's crucial that I check for a selection first or it will copy the whole layer. Please help me with that. Thank you!
Hi
I use "Copy Features" tool to make a layer from selection. It's crucial that I check for a selection first or it will copy the whole layer. Please help me with that. Thank you!
And something like this should also work:
selection = arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION",
where_clause="Field = 'Something'")
result = arcpy.GetCount_management(selection)
count = int(result.getOutput(0))
if count:
print count
arcpy.CopyFeatures.......
See: Get Count
You could use GetCount to count items in the layer before and after the selection and if selection is less than the original count and greater than zero then do the copy.
And something like this should also work:
See: Get Count
You could use GetCount to count items in the layer before and after the selection and if selection is less than the original count and greater than zero then do the copy.