# List People and Feature Classes
people = ['TOM','ADAM','BRIAN','STEVE']
lstfc = arcpy.ListFeatureclasses(workspace)
for fc in lstfc:
#Loop through each feature class printing the last record date that was updated by each person
lstTOM = [row.getvalue('updated_date') for row in arcpy.SearchCursor(fc,"PERSON='TOM')
print str(people[0]) + "has" + " last" + "updated" + "on" + str(lstTOM[-1])
lstADAM = [row.getvalue('updated_date') for row in arcpy.SearchCursor(fc,"PERSON='ADAM')
print str(people[1]) + "has" + " last" + "updated" + "on" + str(lstADAM[-1])
lstBRIAN = [row.getvalue('updated_date') for row in arcpy.SearchCursor(fc,"PERSON='BRIAN')
print str(people[2]) + "has" + " last" + "updated" + "on" + str(lstBRIAN[-1])
lstSTEVE = [row.getvalue('updated_date') for row in arcpy.SearchCursor(fc,"PERSON='STEVE')
print str(people[3]) + "has" + " last" + "updated" + "on" + str(lstSTEVE[-1])
import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
env.overwriteOutput = 1
# create list of editors
people = ["TOM", "ADAM", "BRIAN", "STEVE"]
# specify fields to use with search cursor
fields = ["PERSON", "updated_date"]
# loop through each feature class in test.gdb
lstfc = arcpy.ListFeatureclasses("*")
for fc in lstfc:
# loop through each editor for each feature class
for editor in people:
# create an empty list
list = []
# create a feature layer for each editor
arcpy.MakeFeatureLayer_management(fc, "fc_lyr", "PERSON = '" + editor + "'")
#sort feature layer by updated_date and iterate through each row
for row in arcpy.da.SearchCursor("fc_lyr", fields, sql_clause=(None, 'ORDER BY updated_date')):
# append each date to the list
list.append(row[1])
print editor + " has last updated on" + str(list[-1])
Hi BB,
Here is an example on how to do this:import arcpy from arcpy import env env.workspace = r"C:\temp\python\test.gdb" env.overwriteOutput = 1 people = ["TOM", "ADAM", "BRIAN", "STEVE"] fields = ["PERSON", "updated_date"] lstfc = arcpy.ListFeatureclasses("*") for fc in lstfc: for editor in people: list = [] arcpy.MakeTableView_management(fc, "fc_lyr", "PERSON = '" + editor + "'") #sort by updated_date for row in arcpy.da.SearchCursor("fc_lyr", fields, sql_clause=(None, 'ORDER BY updated_date')): list.append(row[1]) print editor + " has last updated on" + str(list[-1])
arcpy.MakeFeatureLayer_management(fc, "fc_lyr", "PERSON = '" + editor + "'")
arcpy.env.workspace = workspace
... lstfc = sorted(arcpy.ListFeatureClasses())
... states = ['AK','AZ','CA','CO','ES','ID','MT','NM','NV','OR','UT','WY']
... for fc in lstfc:
... for item in states:
... lstnew1 = [row.getValue("created_date") for row in arcpy.SearchCursor(fc,"ADMIN_ST='item'","",fields="ADMIN_ST;created_date",sort_fields="created_date D")]
... print item+" "+ "last updated" +" "+ fc + " "+ "on" + " " + str(lstnew1[0]) +'\n'+'\n'