Skip to Main Content
HCL Domino Ideas Portal

Welcome to the #dominoforever Product Ideas Forum! The place where you can submit product ideas and enhancement request. We encourage you to participate by voting on, commenting on, and creating new ideas. All new ideas will be evaluated by HCL Product Management & Engineering teams, and the next steps will be communicated. While not all submitted ideas will be executed upon, community feedback will play a key role in influencing which ideas are and when they will be implemented.

For more information and upcoming events around #dominoforever, please visit our Destination Domino Page

Status Needs Review
Workspace Domino Designer
Categories LotusScript
Created by Guest
Created on Nov 22, 2021

Add NotesDocument to a Collection like an array

Our Problem:

We are trying to search multiples NotesDocuments from an agent in a database to a view in another database. We then proceed to add those documents to a NotesDocumentCollection with the function AddDocument (NotesDocumentCollection - LotusScript®)
but when we iterate through that collection,after adding all the documents, it is unsorted.


After reading the AddDocument function it says only the ViewEntryCollections and DocumentCollections created from FTSearch are sorted, all other Collections are inserted using an internal algorithm.


Maybe this function could have a boolean that specifies if you want that Collection sorted with the algorithm or you could add the documents like an array.

  • Attach files
  • Guest
    Jan 28, 2022

    I may be wrong but I doubt that a document collection as we have it now can ever be sorted as it does not have enough information about the documents it is referring to. It just knows that a document exists and how to get to it using some kind of index. That makes collections extremly efficient and fast to work with.

    If you want to have them sortable it would to blow them up quite a bit: extract data from the documents, care about datatypes and sizes, need to provide at least one extra index etc. Adding such a feature would most probably mean an entirely new object type (which more or less seems to be evolving right now in the form of NotesQueryResultsProcessor - once it's working properly...).

    But: if you want sorted document lists have a look at views and folders: they can hold and work with info coming from the documents themselves. Or check out JSON or XML structures.

    Btw.: the default "sort" order of collections isn't a myth. Just create a first-to-last loop through "NotesDatabase.AllDocuments" and see for yourself: the first will be the one with the oldest, the last the one the with the most recent creation time stamp. At least that's what I experienced so far.

  • Guest
    Nov 23, 2021

    We have multiples UniversalID in an array and we loop throught that array to search each document individually. Our problem is that when we add the document to the collection it is sorted with the internal algorithm

  • Guest
    Nov 22, 2021

    Why not adding the UniversalID to an array?

    You can loop it with a basic For ... Next loop and easily get the document via the GetDocumentByUnID.