Manage Learn to apply best practices and optimize your operations.

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)

Dig Deeper on Domino Resources - Part 5

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close