gotoLastDocument (NotesViewNavigator - JavaScript)

Moves the current pointer to the last document entry in a view navigator, skipping any totals and category entries.

Defined in

NotesViewNavigator

Syntax

gotoLastDocument() : boolean
Return value Description
boolean
  • true if the operation succeeds
  • false if there are no entries in the view navigator

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");