Manage Learn to apply best practices and optimize your operations.

Refresh Views Via Agent

I wrote this code snippet for a VERY large database. To keep the response time
up (updates to the data were minimal), we set all views to Manual indexing.
This agent updates primary views first, then does all of the remaining views.
I call it hourly, when the agent dies during a run it just resumes the same
view later, by virtue of the other views already being updated and being quick
to finish the second time around.
Change the names of the "MainViews" variable to your own primary views, and
change the number if desired as well. Enjoy.
Sub RefreshViews( All As Variant )
' If all is true, all views are updated. If false, only the Main views
are updated.
' Refreshes Main views first...
Dim MainNames ( 5 ) As String
Dim view As NotesView
Dim Db As NotesDatabase
Dim session As New NotesSession

Set Db = session.CurrentDatabase

MainNames( 0 ) = "MultiSort"
MainNames( 1 ) = "byCertifier"
MainNames( 2 ) = "ByFilename"
MainNames( 3 ) = "Multisort Resp"
MainNames( 4 ) = "ID"
MainNames( 5 ) = "$UserName"

Forall viewname In MainNames
Set view = Db.GetView( viewname )
If Not ( view Is Nothing ) Then
Call view.Refresh
End If
End Forall

' After finishing updating the Main views, update ALL views if we wish to...
' Duplicate views to the Main views will be VERY quick, so don't worry about

If All Then
Forall otherview In Db.Views
If Not ( otherview Is Nothing ) Then
Call otherview.Refresh
End If
End Forall
End If
End Sub

Dig Deeper on Lotus Notes Domino Administration Tools

  • Favorite iSeries cheat sheets

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