Refresh a View's Index

Author: Tripp W Black

Created: 12/17/2002 at 09:44 PM

 

Category:
Notes Developer Tips
LotusScript, Views

Sub Initialize

' The purpose of this script is to open all the views in the database and force a refresh

' It helps performance alot

' =========== History

' Date Who What

' ======================================================================================================

' 990528 Marc Added Lookup to System Profile document to only run on Servers listed there

' 990607 Marc Added more logging of what is going on

'

Dim ProfileDocSys As NotesDocument ' OS System Profile Document

Dim ses As New NotesSession

Dim thisDB As NotesDatabase

Set thisDB = ses.CurrentDatabase

Set ProfileDocSys = thisDB.GetProfileDocument( "POS")

Print "Updating View Agent Starting"

' If ses.IsOnServer = False Then Exit Sub ' Not on a server exit

' Loop through all the servers listed in the System Profile document and see if we are running on one of them

Forall MainServers In ProfileDocSys.P_OS_MainServer

If Lcase(MainServers) = Lcase(thisDB.Server) Then ' Match so go ahead and run

Goto UpdateViews

End If

End Forall

' Fell through no match so bail out

Print "Updating View Agent Terminating - Not on Main Server"

Exit Sub

UpdateViews:

Print "Updating Views "

Forall v In thisDB.Views

' Print "Updating View " + v.name()

Call v.refresh

End Forall

Print "Done Updating Views "

End Sub

previous page