Display a Random Document in a Collection Each Display from Web or Client

Mindwatering Incorporated

Author: Tripp W Black

Created: 06/14/2000 at 09:39 AM


Notes Developer Tips
Agents, LotusScript

Originally from Notes.net

You can open the random document from a LotusScript Web agent by "printing" a URL referencing the random's doc Universal ID.


print "[[" +
dbpath + doc.UniversalID + "?OpenDocument" + "]]"

where doc is your random document.

Original message:

Sub Click(Source As Button)
Dim db As NotesDatabase
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Set db=session.CurrentDatabase
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim view As NotesView
Dim dc As NotesDocumentCollection
Dim x As Integer, y As Integer, RndNum As Integer

Set view=db.GetView("(AllArtworks)")
Set dc=view.GetAllDocumentsByKey("1")

Set doc=dc.GetNthDocument(RndNum)
Set uidoc=workspace.EditDocument(False,doc)
End Sub

previous page