Manage Learn to apply best practices and optimize your operations.

Rebuilding views using a scheduled Lotus Domino agent

This code from member Huzefa Amar Haider will rebuild views using a scheduled Lotus Domino agent, which is helpful when using @TextToNumber(today) in a view's column formula.

This code will show how to rebuild views using a scheduled Lotus Domino agent. This is helpful when we use @TextToNumber(today) in a view's column formula when the view requires a rebuild every day , and refreshing the view will not serve the purpose or reflect the correct value.

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim col As NotesViewColumn
Dim i As Integer
Dim RView As String
On Error Resume Next
Set db = session.CurrentDatabase
' List of views which u wants to rebuild
Dim Rviews() As String
Redim Rviews(0 To 2) 
' a temporary change in design of views needs to be made in order to rebuild a view 
' we are doing it by adding a temporary Column  and deleting it back.
While i<=Ubound(Rviews)
Set view = db.GetView(Rviews(i))
Set col = view.CreateColumn(view.ColumnCount + 1, "Test","OrderNo")
Call view.Refresh
Set col = view.Columns(view.ColumnCount - 1)
Call view.RemoveColumn(view.ColumnCount)
Call view.Refresh
Print "View -" & i
End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the tip library by member Huzefa Amar Haider. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on Lotus Notes Domino Agents



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ 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