Select to view content in your preferred language

Querying Edit Tracking Fields

269
0
03-15-2024 12:40 PM
cog_GIS_Admin
Emerging Contributor

I have tried too many iterations to list. I cannot get the python script to read the editor tracking fields. When I query other fields it is okay. such as:
where_clause = "Object ID < 5" works, but

where_clause = "LAST_EDITED_USER = 'Benny Hill'" it fails

Whenever I put any editor tracking fields in the where_clause, the script bombs out.

num_days = 10
today = datetime.today().isoformat(' ', 'seconds')
print ("Today is: ",current_date)
td = datetime.today()
print ("Date Time today is ",td)
sd = td - timedelta(days= num_days)
print ("Time Delta is: ",sd)
start_date = sd.strftime('%m-%d-%Y %H:%M:%S')
print ("Last Edited from: " + str(start_date))

where_clause - where_clause = "LAST_EDITED_DATE <= TO_DATE('{0}', 'YYYY-MM-DD HH24:MI:SS') And LAST_EDITED_DATE > TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS')".format(str(today), str(start_date))

selection = arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", where_clause)

 

Original query that no longer works

where_clause = "LAST_EDITED_DATE <= TO_DATE('{0}', 'YYYY-MM-DD HH24:MI:SS') And LAST_EDITED_DATE > TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS')".format(str(today), str(start_date))

 

Any suggestions would be greatly appreciated.🙂

0 Kudos
0 Replies