import arcpy import datetime arcpy.env.overwriteOutput = True territory= arcpy.GetParameterAsText(0) path= arcpy.GetParameterAsText(1) territory_lyr= path+ "territorios_lyr" arcpy.MakeFeatureLayer_management(territory,territory_lyr) fields= ("FID", "avg_mindis", "I_conc", "Max_lenght","TamanoTerr") with arcpy.da.UpdateCursor(territory, fields) as cursor: for row in cursor: currentID= row[0] where= "FID="+str(currentID) arcpy.SelectLayerByAttribute_management(territory_lyr, "NEW_SELECTION",where)
Solved! Go to Solution.
fldFID = arcpy.Describe(territory).OIDFieldName fields= (fldFID, "avg_mindis", "I_conc", "Max_lenght","TamanoTerr") with arcpy.da.UpdateCursor(territory, fields) as cursor: for row in cursor: currentID = row[0] where = "{0}={1}".format(arcpy.AddFieldDelimiters(territory, fldFID), currentID) arcpy.SelectLayerByAttribute_management(territory_lyr, "NEW_SELECTION", where) # do something with the selection...
fldFID = arcpy.Describe(territory).OIDFieldName fields= (fldFID, "avg_mindis", "I_conc", "Max_lenght","TamanoTerr") with arcpy.da.UpdateCursor(territory, fields) as cursor: for row in cursor: currentID = row[0] where = "{0}={1}".format(arcpy.AddFieldDelimiters(territory, fldFID), currentID) arcpy.SelectLayerByAttribute_management(territory_lyr, "NEW_SELECTION", where) # do something with the selection...