Manage Learn to apply best practices and optimize your operations.

Build list of views, and open selected view via LotusScript

How to build a list of all views in the current DB and then open the selected view in the specified frame within a frameset.

This code will build a list of all views in the current database, and then open the selected view in the specified frame within a frameset. This can be very tricky because it uses the NotesUIworkspace to instantiate an object of the NotesUIdatabase class.

Sub Click(Source As Button)
 On Error Goto processError
 Dim workspace As New NotesUIWorkspace
 Dim Session As New NotesSession
 Dim uidoc As NotesUIDocument
 Dim collectionDoc As NotesDocument
 Dim collectionViews() As String
 Dim doc As NotesDocument
 Dim uidb As NotesUIDatabase
 Dim db As NotesDatabase
 Dim thisView As String 
 
 Dim i As Integer
 
 i = 0 
 Set db = Session.CurrentDatabase
 Set uidb = workspace.CurrentDatabase
 
 Forall v In db.Views
  temp = Cstr(v.name)
  Redim Preserve collectionViews(i + 1)
  collectionViews(i) = v.name   
  i = i + 1   
 End Forall
 
 thisView = workspace.Prompt
(PROMPT_OKCANCELLIST, "Available Views", 
"This is a list of views in this database. 
Highlight the view you want to open and
 select OK.",  collectionViews(0), collectionViews)
 Call workspace.SetTargetFrame
("your_target_frame")
 Call uidb.OpenView(thisView, "", "1") 
 
 
processError:
 Resume Next
End Sub

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

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

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

SearchDataCenter

SearchContentManagement

Close