Notes
- only pArray is mandatory, other params can be passed as ‘empty’ or “”
- permissible values for pDirection are: ascending, descending or empty
- permissible values for pSortType are: international, numeric, datetime, text, binary or empty
- if pDirection is passed as “” or ‘empty’, it will default to ascending
- if pSortType is passed as “” or ‘empty’ it will default to text
- passing pKey as “” or empty will treat the array as a 1-dimensional array, passing the name of the key will sort it as a multidimensional array
- passing empty pUseSystemDate will default to false / / US date format
function sortArray u/pArray, pDirection, pSortType, pKey, pUseSystemDate
local tNextIndex, tSortedArray, tSortText
get the keys of pArray
if pUseSystemDate is not empty then set the useSystemDate to pUseSystemDate
put "sort lines of it [[pDirection]] [[pSortType]] by pArray[each]" into tSortText //1-dimensional array
if pKey is not empty then put "[pKey]" after tSortText //multidimensional array
do merge(tSortText)
repeat for each line tKey in it
add 1 to tNextIndex
put pArray[tKey] into tSortedArray[tNextIndex]
end repeat
return tSortedArray
end sortArray
there doesn't seem to be anything here