LOTUSSCRIPT/COM/OLE CLASSES
Examples: Retrieving entries from a view entry collection
1. This example finds an entry in the collection and places it in a folder.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entryOne As NotesViewEntry
Dim entryTwo As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("By Category")
Set vc = view.GetAllEntriesByKey("Books")
Set entryOne = vc.GetNthEntry(2)
Set entryTwo = vc.GetEntry(entryOne)
Set doc = entryTwo.Document
Call doc.PutInFolder("Shopping Cart")
End Sub
2. This example finds the first and last entries in a collection.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim entry2 As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("By Category")
Set vc = view.GetAllEntriesByKey("Products")
Set entry = vc.GetFirstEntry()
Set entry2 = vc.GetLastEntry()
Set doc = entry.Document
Set doc2 = entry2.Document
Call doc.PutInFolder("First entries")
Call doc2.PutInfolder("First entries")
End Sub
3. This example collects all of the entries in a view with the
GetAllEntriesByKey
method of NotesView, and traverses the collection by using the
GetFirstEntry
and
GetNextEntry
methods of NotesViewEntryCollection. Alternatively you can use the
GetLastEntry
and
GetPrevEntry
methods to traverse the collection backwards.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView("By Category")
Set vc = view.GetAllEntriesByKey("Products")
Set entry = vc.GetFirstEntry()
While Not(Entry Is Nothing)
Set entry = vc.GetNextEntry(entry)
Wend
End Sub
See Also
Retrieving entries from a view entry collection
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary