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 Under Consideration
Workspace Domino Designer
Categories LotusScript
Created by Guest
Created on May 2, 2019

Designer : Please provide method copying all documents in the view into document collection.

We would like to process all documents in a view and change field specified in view selection formula.

But if we change the field specified in view selection formula, view index will be changed even if view auto refresh is set false, and LotusScript will fail at GetNextDocument when view index is updated by server.

Please provide method copying all documents in the view into document collection or don't refresh view when view auto refresh is set false .

set dc = view.allducuments

  • Attach files
  • Guest
    Reply
    |
    May 20, 2021

    @OP - You don't want to loop through the documents in the view while you update the same documents. Like others already mentioned, you can use the AutoUpdate property of the NotesView class to prevent view updates while you are processing the documents, but my code is safer, since it is just getting the UNID of all documents in the view, then processing them without using the view anymore.
    Why should HCL implement a function that is really not needed, just because you don't have the ability to write code using exiting functions? Would not their time be better spent on creating actual new functionality?

  • Guest
    Reply
    |
    May 11, 2019

    I understand your code, but do you think dc=view.alldocuments is simple for us ?

  • Guest
    Reply
    |
    May 6, 2019

    This is trivial.

    Loop through the view collection and store all documents in a list, or at least the DocUNID. Then you can process all the documents in the list without any issues.

    Something like this:

    Dim docs List As NotesDocument
    Set col = view.AllEntries
    Set entry = col.GetFirstEntry()
    Do Until entry is Nothing
    Set docs(entry.Document.UniversalID) = entry.Document
    Set entry = col.GetNextEntry(entry)
    Loop
    ForAll doc in docs
    Call doc.ReplaceItemValue("YourField","New Value")
    Call doc.Save(True,False)
    Next

     

  • Guest
    Reply
    |
    May 4, 2019

    In this case view.autoupdate=False doesn't work as expected , I described. 

  • Guest
    Reply
    |
    May 3, 2019

    Put view.autoupdate=false before you start doing your updates. This prevents the view from changing.

    change it to true when done.

    Designer help link

     

    works perfectly!

  • Guest
    Reply
    |
    May 2, 2019

    No!

    I know document pointer is changed at field update, so I keep document as you described, but this issue will occur.

     

    Please try yourself !

  • Guest
    Reply
    |
    May 2, 2019

    Common problem.  The way around this is to get a handle on the next document (eg doc1) in the view before starting your loop.  After processing the first document (eg doc), pass the doc1 handle to doc (if it isn't nothing otherwise your loop has finished) and then get the new next document before repeating the loop.