I created a view to display private content by username. In view’s initialize event I added the following scripts:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim formula As String
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("myview")
formula = "Select Form='myform'&UserName='"+session.UserName+"'"
view.SelectionFormula=formula
Call view.refresh
The Scripts only worked when I opened the view twice.I created an action to check my code.The action’scode is as following:
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim view As NotesView
Set uiview = ws.CurrentView
Set view = uiview.View
Messagebox view.SelectionFormula
When I opened the view at the first time,the view.SelectionFormula looked right as content wasn’t what I expected.When I opened the view the second time,everything was ok.Now problem is after user A opened the view, user B will see user A’s content when he open the view. Please help me.