Jos,
Not sure how elegant this is, but it might work for you.
Assuming you have another field in the table that has an index:
SELECT IndexField, DateTimeField ;
FROM MyTable ORDER BY 2 INTO CURSOR MyOrder
SET ORDER TO IndexField IN MyTable
SELECT MyOrder
SET RELATION TO IndexField INTO MyTable
SCAN
Process MyTable
REPLACE MyTable.DateTimeField WITH DATETIME()
ENDSCAN
HTHs,
>Hi All
>
>I have a table and for each record I want to execute a process and then store the datetime when the process for that record was completed.
>
>I also want to process the records in this same datetime order so that I can loop through all records and process each from the oldest record on file to the most current. So there is an index on that datetime field and which is set as the index to use for dropping through the file.
>
>Of course as soon as I update the first record with the current datetime it moves to the end of the index and the subsequent SKIP positions me at EOF.
>
>I cannot GO TOP since that would put the app in an endless loop. I want to process all the records once, from oldest update to latest udpate.
>
>I can store the update datetime into a second field and then go back over all records when the entire file is done and update the index datetime field with this second field but that would mean that a second instance of my app would not know the correct record to process next <g>
>
>Anybody had a similar situation with an elegant solution?
>
>Thanks
Jim