hi, i try to add a point xy to feature class and i want to select the latest record in table (recently added). The script runs and I don't have any error message but the tool doesn't select any thing. How can I fix this?
import arcpy
arcpy.env.workspace = r'D:\Geodatabases\BD_VOCATION.gdb '
points = r'D:\Geodatabases\BD_VOCATION.gdb\Loc_vocation'
try:
arcpy.MakeFeatureLayer_management(points,'points_layer')
rows = arcpy.SearchCursor(points,'','',"OBJECTID", "OBJECTID D")
lst = [] for row in rows:
m = row.getValue("OBJECTID")
lst.append(m)
v = lst[0]
r= str(v)
query = """{0} = {1}""".format(arcpy.AddFieldDelimiters(points, "OBJECTID"), int(r))
arcpy.SelectLayerByAttribute_management("points_layer", "NEW_SELECTION", query)
except:
print "An error occured during selection"
... View more