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

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close