Manage Learn to apply best practices and optimize your operations.

Simulating A Dynamic View Using Folders

I have seen a number of situations where it would be great to have a user
answer a few prompted questions and have the view display the corresponding
documents. Views do not handle dynamics very well, but I found that folders
work wonderfully.

I reccomend setting the folder up as Shared, private on first use, but it must
be stored in the server copy. You can then setup 2 scripts one that empties the
folder and one that populates it. You could also delete the view instead of
clearing it.

When I set it up, I established the scripts as agents that run from buttons in
the folder, this allows the user to perform multiple searches without having to
close and open the folder.

Below I have included sample script and @functions for the button and agents.

The folder can be categorized or display the docs any way that is desired. I
coded the Empty agent to remove docs from the bottom up, as I have found this
method to work better when working from categorized views.
'Programming behind button to run the scripts
user := @Name([CN];@PickList([Name]: [Single]));
rdate := @Prompt([OKCANCELEDIT];"Enter Start Date";"Enter start date for the
report:" + @Char(13) + "The database contains information from the past 60 days
@Environment("TRName"; user);
@Environment("TRDate"; rdate);
@PostedCommand([ToolsRunMacro]; "(EmptyFolder)");
@PostedCommand([ToolsRunMacro]; "(CreateTimeReport)")

'Add entries to folder agent
Sub Initialize
Dim W As New NotesUIWorkspace
Dim S As New NotesSession
Dim CurDB As NotesDatabase
Dim LView As NotesView
Dim TFolder As NotesView
Dim DColl As NotesDocumentCollection
Dim Doc As NotesDocument
Dim TRDate As String
Dim TRName As String

Set CurDB = S.CurrentDatabase
Set LView = CurDB.GetView("(TimeLookup)")
Set TFolder = CurDB.GetView("Time Report")

TRName = S.GetEnvironmentString("TRName")
TRDate = S.GetEnvironmentString("TRDate")

Set DColl = LView.GetAllDocumentsByKey(TRName, True)
If DColl.Count > 0 Then
Set Doc = DColl.GetFirstDocument
While Not(Doc Is Nothing)
If Datevalue(Doc.EntryDate(0)) >= Datevalue(TRDate) Then
Call Doc.PutInFolder("Time Report")
End If
Set Doc = DColl.GetNextDocument(Doc)
End If
Call TFolder.Refresh
End Sub

'Empty Folder Agent
Sub Initialize
Dim S As New NotesSession
Dim CurDB As NotesDatabase
Dim TFolder As NotesView
Dim Doc As NotesDocument
Dim TDoc As NotesDocument

Set CurDB = S.CurrentDatabase
Set TFolder = CurDB.GetView("Time Report")
Set Doc = TFolder.GetLastDocument

While Not(Doc Is Nothing)
Set TDoc = Doc
Set Doc = TFolder.GetPrevDocument(Doc)
Call TDoc.RemoveFromFolder("Time Report")
Call TFolder.Refresh
End Sub

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • 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 ...