Examples: CopyColumn method

This agent removes all the columns in a view and recreates the view by copying two columns 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.GetView("Topics")
  While viewTopics.ColumnCount > 0
    Call viewTopics.RemoveColumn(viewTopics.ColumnCount)
  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