A problem with the getnthdocument view method

hi!

i have a question about the limitations of the getnthdocument view method. the designer help says:

Set notesDocument = notesView.GetNthDocument( index& )

Parameters

index&

Long. A number indicating the document to return. Use 1 to indicate the first document in the view, 2 to indicate the second document, and so on.

and when you lookup the long data type in the designer help you’ll find the following:

Long

Signed long integer -2,147,483,648 to 2,147,483,647

so the method should be safe to use on views with 2147483647 documents or less, or am i missing something? because when i test it on a view i don’t get any document hits on the position 31258 and forward (on a view containing 31275 documents).

can any one explain this to me and hopefully offer a fix?

**** A bit of code that generates this error ****

Set caseDoc = vpStatView.GetFirstDocument

casePosLong = 0



Do Until caseDoc Is Nothing

	casePosLong = casePosLong + 1

	Set secondDoc = vpStatView.GetNthDocument(casePosLong)

	If secondDoc Is Nothing Then Error HNDL_ERR, "Hittade inte dokument med position " + Cstr(casePosLong) + " i vy " + vpStatView.Name		

	

	Set caseDoc = vpStatView.GetNextDocument(caseDoc)

Loop

**** End Code ****

regards Patrik Ström

Subject: A problem with the getnthdocument view method

Patrik,

As per my understanding use the GetNthDocument of NotesView to get a document at a known position within the top-level (main) documents of a view or folder.

E.g, case of configuration documents view where you know exact number of documents to pass as argument. Your code is not ideal for this method.

Designer help says “Using getNthDocument to iterate through a loop is strongly discouraged for performance reasons.” It means this method is not suitable when you have lots of documents in a view.

I assume Andre/Stan can say much on this topic .

Rishi

Subject: RE: A problem with the getnthdocument view method

the code i posted was only to illustrate the problem, it’s not the code i use in my intended implementation.

in the example code i use was just so see where it went wrong. in my indended implementation uses getnthdocument to pick up where another “document run through” left off. just to get the last document the previous routine read and then loop through the existing with the getnextdocument method.