Examples: CreateView method

This agent creates a new view and adds two columns by copying them from another view.

Sub Initialize
  Dim s As New NotesSession
  Dim viewAll As NotesView
  Dim viewTopics As NotesView
  Dim col1 As NotesViewColumn
  Dim col2 As NotesViewColumn
  Set viewAll = s.CurrentDatabase.GetView("All Documents")
  Set viewTopics = _
  s.CurrentDatabase.CreateView("Topics", "SELECT @All")
  Set col1 = viewTopics.CopyColumn(viewAll.Columns(4), 1)
  Messagebox col1.Title,, "Column " & col1.Position
  Set col2 = viewTopics.CopyColumn(viewAll.Columns(0), 2)
  Messagebox col2.Title,, "Column " & col2.Position
End Sub