getChild (NotesViewNavigator - JavaScript)

Returns the first child of an entry in a view navigator.

Defined in

NotesViewNavigator

Syntax

getChild() : NotesViewEntry

getChild(entry:NotesViewEntry) : NotesViewEntry

Parameter Description
entry An entry in the view. Defaults to the current entry. Cannot be null.
Return value Description
NotesViewEntry The first child of the current or specified entry. Returns null if there are no children.

Usage

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

A child of a category entry can be a category or document entry.

Examples

This button gets all entries in a view in hierarchical order.
var nav:NotesViewNavigator = database.getView("By category").createViewNav();
var entry:NotesViewEntry = nav.getFirst();
getentry();

function getentry() { // recursive
	if (entry == null) return;
	if (entry.isCategory()) {
		requestScope.status += "\n" +
		entry.getPosition(".") + " " +
		entry.getColumnValues().firstElement().toString();
	} else if (entry.isDocument()) {
		requestScope.status += "\n" +
		entry.getPosition(".") + " " +
		entry.getColumnValues().elementAt(1).toString();
	} else if (entry.isTotal())  {
		requestScope.status += "\n" +
		entry.getPosition(".") + " " +
		entry.getColumnValues().elementAt(3).toString();
	}
	// try for first child
	// if no child, try for next sibling
	// if no sibling, go up a level and try for next sibling
	var tmpentry:NotesViewEntry = nav.getChild(entry);
	if (tmpentry == null) tmpentry = nav.getNextSibling(entry);
	if (tmpentry == null) {
		tmpentry = nav.getParent(entry);
		if (tmpentry != null) tmpentry = nav.getNextSibling(tmpentry);
	}
	entry.recycle();
	entry = tmpentry;
	getentry();
	return;
}