Sorting a NotesDocumentCollection by multiple field values (Show’n Tell Thursday)October 26th, 2006
I have been using Joe Littons sortCollection function with success to sort a NotesDocumentCollection by the value in a specific field name. However the function can only sort by one field value and I recently had the requirement to be able to sort by multiple field values.
Max Flodén has created a function that does exactly that: sorts a NotesDocumentCollection by one or more field values. But the code from Max uses Evaluate and @Sort to do the actual sorting - and therefore has problems with quotes in the values and apparently also a problem with large collections (see comments to his post).
So I have combined the best from the two sort functions - the sortValues function from Joe Litton that uses Shell sort and the option to sort by multiple field values from Max Flodén - to get a function that sorts a NotesDocumentCollection by one or more field values.
Update November 21: During testing I found an unnecessary loop in the sortCollection function. I have therefore updated the sort function.
Update December 9, 2011: The function is now available on the new OpenNTF XSnippets site.