This behavior sorts as many linear lists as you wish ordering by one of them, at your choice
-- created by Emmanuel Nedelec e.nedelec@wanadoo.fr
-- parameters :
-- ListOfLists : a list of the several lists to sort
-- it can be for example :
-- [["Martin","Dave","John"],["Smith","Johnson","McRoy"],
-- [33,45,26]]
-- orderChoice : the rank of the list to use to sort
-- to continue the example, sorting by Name would be 2,
-- by age would be 3
-- return :
-- a new list of lists sorted as you wished
on MultiSort ListofLists, orderChoice
set nbList = count (ListofLists)
set mySorList = getAt (ListofLists, orderChoice)
set myMax = count (mySorList)
set newList = [:]
repeat with i = 1 to myMax
addProp newList, mySorList [i], i
end repeat
sort newList
set newListList = []
repeat with i = 1 to nbList
add newListList, []
end repeat
repeat with i = 1 to myMax
set myPos = getAt (newList,i)
repeat with j = 1 to nbList
newListList[j][i] = ListofLists[j][myPos]
updatestage
end repeat
end repeat
return newListList
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA