getNthEntry (NotesViewEntryCollection - JavaScript™)
Gets the entry at a specified position in a view entry collection.
Defined in
NotesViewEntryCollectionSyntax
getNthEntry(n:int) : NotesViewEntry
Parameter | Description |
---|---|
n |
A number indicating the entry to return. Use 1 to indicate the first entry in the collection, 2 to indicate the second entry, and so on. |
Return value | Description |
---|---|
NotesViewEntry |
The entry in the nth position in the view entry collection. If there is no document at the specified position, returns null. |
Usage
View collections are renumbered when deletions occur so that the positions of entries after the deleted entry change.Using this method to iterate through a loop is strongly discouraged for performance reasons. See getFirstEntry, getLastEntry, getNextEntry, and getPrevEntry for the preferred loop structure.
Examples
This button gets the document in a view at a specified position.var n:int = parseInt(requestScope.query);
if (isNaN(n)) {
requestScope.status = "Not a number";
return;
}
var mainview:NotesView =database.getView("main");
var vec:NotesViewEntryCollection = mainview.getAllEntries();
var entry:NotesViewEntry = vec.getNthEntry(n);
if (entry == null) {
requestScope.status = "No document at that position";
return;
}
requestScope.status = entry.getDocument().getItemValueString("subject");