Sorted when using UnprocessedDocument

I’m developing a database which gets selected documents to process. I created a view and expected that it will get documents ordering by a column and as shown in the screen.

But I found that UnprocessedDocument and getting documents to process as code below will get document by modified date. This makes my code not work. Does anybody know how to get documents ordered as shown in the view?

Set collection = db.UnprocessedDocuments

Set doc = collection.GetFirstDocument()

Set doc = collection.GetNextDocument(doc)

Appreciated any comments from yours.

Boon.

Subject: Sorted when using UnprocessedDocument

Use the view object eg;

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Set view = db.GetView(“YourView”)

Set doc = view.GetFirstDocument

While Not doc Is Nothing

'Do stuff here

Set doc = view.GetNextDocument(doc)

Loop

Subject: RE: Sorted when using UnprocessedDocument

That won’t work for his problem, which is to run on a batch of selected documents, not the entire contents of the view.

Not entirely, anyway. I can see two ways around this. One is to go through a large song and dance to sort the document collection (which involves, in my experience, putting the documents into an array and sorting that. An easier way, which is an option because there’s already an appropriate sorted view, is to go through the document collection, compile a list of UNIDs, then loop through the views. If the ID of any given document is in the list, process it as appropriate, otherwise ignore it and move on to the next.

Subject: What about using a temp. folder ?