getNth (NotesViewNavigator - JavaScript)

Returns the entry at a specified position in the top level of a view navigator.

Defined in

NotesViewNavigator

Syntax

getNth(n:int) : NotesViewEntry
Parameter Description
n Position of the entry, where 1 is the first entry.
Return value Description
NotesViewEntry The nth top-level entry. Returns null if there is no nth top-level entry.

Usage

This method moves the current pointer to the retrieved entry unless the return value is null.

If you do not have reader access to the specified document, this method returns the next document to which you have reader access. If you increment n, the increment is relative to the actual value of n, not the document that was accessed. So you will access the same document repeatedly until that document actually is the nth document.

Using getNth to iterate through a loop is strongly discouraged for performance reasons. See getNext, getNextCategory, getNextDocument, getNextSibling, getPrev, getPrevCategory, getPrevDocument, and getPrevSibling for the preferred loop structures.

Examples

This onclick event for an edit box displays information for a view entry identified by position. A global variable tracks the position. The user clicks the edit box to get the next entry.
var v:NotesView = database.getView("main");
var nav:NotesViewNavigator = v.createViewNav();
sessionScope.nth++;
var entry:NotesViewEntry = nav.getNth(sessionScope.nth * 1);
if (entry == null) {
	sessionScope.nth = 1;
	var entry:NotesViewEntry = nav.getNth(1);
}
// requestScope.entry is bound to the edit box of this onclick event
requestScope.entry = entry.getPosition(".") + " " +
	entry.getColumnValues().firstElement();