I have a number field with duplicate no’s (1,1,1,1,2,2,2,2,3,4,5 etc) which defines the position of the data in a view. I would like to keep this sorting or sort the data when a database.search is performed, which returns a NotesDocumentCollection.
Ulrick Krause has posted a solution using Treemap, but a Treemap doesn’t allow duplicates: http://openntf.org/XSnippets.nsf/snippet.xsp?id=sort-notesdocumentcollection-by-itemname
Any suggestions in server side JS would be really appreciated.
You could to this with a Vector instead of only adding the documents. Something like this:
Then you have to iterate the Map and the containing Vectors to get your result sorted.
Edit:
And this is how you create the resulting Vector: