Hi
I think I have found a bug in NotesDatabase.Search() function.
Or it is a bug in a While statement, not sure.
Let me explain.
If you define 3rd parameter in NotesDatabase.Search() to set a number of documents you want returned and then try to enumerate documents in block While you will see that code will pass through ALL documents no matter how many documents are in collection.
NotesDatabase.FTSearch() instead works OK.
See example below.
Sub Initialize
Dim s As New notessession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim note As NotesDocument
Dim counter As Integer
Set db = s.Currentdatabase
Set col = db.Search({Form="fmDDMAdministrationProbe"}, Nothing, 10) '<-- limited to 10 docs
Set note = col.Getfirstdocument()
While Not note Is Nothing
counter = counter + 1
Print counter, col.count
Set note = col.getnextdocument(note)
Wend
End Sub
Now let's run it.
Checked in IBM Notes 9.0.1
No comments:
Post a Comment