Manage Learn to apply best practices and optimize your operations.

Convert A Notesdocumentcollection To An Array Of Notesdocuments

This will Convert a NotesDocumentCollection to an Array of NotesDocuments.
Sometimes we have a need to process two document collections as one list. This
will allow you to do that. First convert to an array with this script, then
combine the arrays. This example uses references to my my "Examples" database
in the code.

Option Public

Dim i As Integer
Dim doc As NotesDocument
Dim n As Integer, sorted As Integer
Dim s1, s2 As String
Dim docs() As NotesDocument

Sub CollectionToArray(col As NotesDocumentCollection, docs() As NotesDocument)

n = col.count
Redim docs(n-1) As NotesDocument

For i = 0 To (n-1)
Set docs(i) = col.GetNthDocument(i+1)

End Sub

Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim dt As New NotesDatetime("")
query = |Form = "Example"|

Set db = session.CurrentDatabase
Set dc = db.Search(query, dt, 0)
Print |There are | & dc.Count & | documents in the collection|
If dc.Count > 0 Then
Call CollectionToArray(dc, docs() )
Print |There are | & Ubound(docs) + 1 & | Documents in the new array|
Print "No Documents Selected"
End If

Dig Deeper on Domino Resources - Part 3



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