2

I am looking to get a count on the polygonNieghbor and if it has polygons in it then I want to move to the next step MakeFeatureLayer. and If it doesn't have any features I would like it to finish.

Is there any other way to do this?

arcpy.GetCount_management(PolygonNeighbor_TableSelect)
arcpy.AddMessage(arcpy.GetMessages())

if arcpy.GetCount_management(PolygonNeighbor_TableSelect) > 0:
    arcpy.MakeFeatureLayer_management(MapUnitPolys, inFeatures_lyr)
 else
     print "done"
7

All geoprocessing tools produce a Results object. You want the first output of your GetCount results object. The output will be a string, so you also must convert the string to an integer.

if int (arcpy.GetCount_management(PolygonNeighbor_TableSelect) [0]) > 0:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.