I am updating my app loader program. One of the things that I
need to determine is the executable with the latest date (in the
directory entry). This is surprisingly awkward, because adir()
returns date and time separately, and asort() sorts one column.
Perhaps, I am missing a more suitable function.
Approach 1:
adir() to get the candidate filenames
asort() by date descending
find last element in array with latest date
asort() by time descending elements with latest date
return first filename in array
Approach 2:
adir() to get the candidate filenames
create cursor
append cursor from array
select max(dtos(dirdate)+dirtime) as maxwhen from cursor
select * from cursor where dtos(dirdate)+dirtime=maxwhen
into cursor2
return first filename in cursor2 (Ideally, there is only 1.)
Ha! And I thought that the SQL approach would be shorter.
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.