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



  • iSeries tutorials'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 ...