#dominoforever | Product 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

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

  • Guest
  • May 2 2019
  • Under Consideration
  • Attach files
  • Guest commented
    20 May, 2021 03:49pm

    @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 commented
    11 May, 2019 01:40pm

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

  • Guest commented
    6 May, 2019 04:31pm

    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 commented
    4 May, 2019 02:59am

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

  • Guest commented
    3 May, 2019 09:22pm

    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 commented
    2 May, 2019 10:16pm

    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 commented
    2 May, 2019 02:17pm

    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.