How to get values of last row in table with ArcPy/SearchCursor?

المشرف العام

Administrator
طاقم الإدارة
I would like to base my query on the last row of a table? I know the basic syntax/functionality for my search cursor, how do I query only the last row;

Below is an example of my search criteria, this data comes from a log of success/fail for a script that runs, I will base other decisions off of the success or fail later in the application.

How do I add to my existing code the function to look in the last row, to getValue of timeand success or fail

I am using ArcGIS 10.2.

cursor = arcpy.SearchCursor(aTable,"""Time > DATEADD(minute, -2, GETDATE())""")for row in cursor: print(row.getValue("Time"))if row.getValue("Time") < datetime.datetime.now().strftime('%m/%d/%Y %H:%M:%S'): print "true"else: print "false"This is later implemented in the script and creates the success or fail values as yes and norespectively.

rows = arcpy.InsertCursor(aTable)for x in xrange(0, outputobjects): row = rows.newRow() row.setValue("Success", 'YES') row.setValue("Fail", 'NO') row.setValue("Time", Start) rows.insertRow(row)

أكثر...
 
أعلى