: Is there a simple way to sort a list of records by one property,
: that property being a time (date)?
There seems to be. The following is based on the ASCII_Sort routine in the Essential Subroutines portion of the guidebook, with a couple changes to handle lists of records.
set myList to {{apptTime:date "Friday, January 1, 1904 6:30:00 PM", apptTitle:"Huntington"}, {apptTime:date "Friday, January 1, 1904 8:30:00 PM", apptTitle:"Drive"}, {apptTime:date "Friday, January 1, 1904 4:00:00 PM", apptTitle:"Drive"}, {apptTime:date "Friday, January 1, 1904 8:30:00 AM", apptTitle:"MB Staff Meeting"}}
set orderedList to RSort(myList)
on RSort(my_list) -- ASCII_Sort from the guidebook, with minor changes
set the index_list to {}
set the sorted_list to {}
repeat (the number of items in my_list) times
set the low_item to ""
repeat with i from 1 to (number of items in my_list)
if i is not in the index_list then
set this_item to item i of my_list
if the low_item is "" then
set the low_item to this_item
set the low_item_index to i
else if (apptTime of this_item < apptTime of low_item) then
set the low_item to this_item
set the low_item_index to isorted_list to the low_item
set the end of the index_list to the low_item_index
end repeat
return the sorted_list
end RSort
–tet