getPrevDocument (NotesView - JavaScript)

Given a document in a view, returns the document immediately preceding it.

Defined in

NotesView

Syntax

getPrevDocument(doc:NotesDocument) : NotesDocument
Parameter Description
doc Any document in the view. Cannot be null.
Return value Description
NotesDocument The document preceding the parameter. Returns null if there is no preceding document.

Usage

If the view is filtered by FTSearch, this method returns the first document in the filtered view.

The NotesViewNavigator and NotesViewEntryCollection classes provide more efficient methods for navigating views and accessing entries.

Examples

This button gets all the documents in a view from last to first.
var v:NotesView = database.getView("main");
var doc:NotesDocument = v.getLastDocument();
while (doc != null) {
	requestScope.status += "\n" + 
		doc.getItemValueString("subject");
	var tmpdoc = v.getPrevDocument(doc);
	doc.recycle();
	doc = tmpdoc;
}