Refresh all documents in a view (and skip the bad ones)
This script tries to refresh (and save)a document, and skips it when refreshing fails.
To refresh all documents in a view, you could use @Command([ViewRefreshAllDocuments]). Only, when one document does not pass the validation, refreshing stops without giving you any clue how many documents were refreshed.
This script tries to refresh (and save)a document, and skips it when refreshing fails. When the work is done, the user is informed how many documents were refreshed (and how many were skipped.)
Dim ws As New notesuiworkspace Dim uiview As notesuiview Dim session As New notessession Dim db As notesdatabase Dim view As notesview Dim doc As notesdocument Dim intOK As Integer Dim intError As Integer Set db = session.currentdatabase Set uiview = ws.currentview Set view = uiview.view Set doc = view.getfirstdocument intOK = 0 inError = 0 Do While Not doc Is Nothing success = doc.ComputeWithForm( False, False ) If success Then intOK = intOK + 1 Call doc.Save( True, True ) Else intError = intError + 1 End If Print "Done: " & Cstr(intOK) & ", skipped: " & Cstr(intError) Set doc = view.getnextdocument(doc) Loop Messagebox "Finished. Number of refreshed documents: " & Cstr(intOK) & ". Number of skipped documents: " _ & Cstr(intError)