gotoFirst (NotesViewNavigator - JavaScript)

Moves the current pointer to the first entry in a view navigator.

Defined in

NotesViewNavigator

Syntax

gotoFirst() : 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 view entry by number where 1 is the first entry and -1 is the last entry.
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 entry where 1 is the first entry
if (n > 0) {
	nav.gotoFirst();
	for (var i = 1; i < n; i++) {
		nav.gotoNext();
	}
// For negative number, get the -nth entry where -1 is the last entry
} else {
	nav.gotoLast();
	for (var i = -1; i > n; i--) {
		nav.gotoPrev();
	}
}
entry = nav.getCurrent();
requestScope.status += "\n" + entry.getPosition(".") + " ";
if (entry.isCategory()) {
	requestScope.status += entry.getColumnValues().elementAt(entry.getIndentLevel());
} else if (entry.isDocument()) {
	requestScope.status += entry.getDocument().getItemValueString("subject");
}