gotoNextDocument (NotesViewNavigator - JavaScript)

Moves the current pointer to the next document entry of the current entry in a view navigator.

Defined in

NotesViewNavigator

Syntax

gotoNextDocument() : boolean
Return value Description
boolean
  • true if the operation succeeds
  • false if there is no next document entry

Examples

This button gets a document view entry by number where 1 is the first document and -1 is the last document.
var nav:NotesViewNavigator = database.getView("By category and date").createViewNav();
if (nav.getCount() == 0) return;
// User enters a number in the input box bound to requestScope.query
var n:int = parseInt(requestScope.query);
if (isNaN(n) || n == 0) n = 1;
// For positive number, get the nth document where 1 is the first document
if (n > 0) {
	nav.gotoFirstDocument();
	for (var i = 1; i < n; i++) {
		nav.gotoNextDocument();
	}
// For negative number, get the -nth document where -1 is the last document
} else {
	nav.gotoLastDocument();
	for (var i = -1; i > n; i--) {
		nav.gotoPrevDocument();
	}
}
entry = nav.getCurrent();
requestScope.status += "\n" + entry.getPosition(".") + " ";
requestScope.status += entry.getDocument().getItemValueString("subject");