getNextSibling (NotesView - JavaScript)

Given a document in a view, returns the document immediately following it at the same level. If you send the method a main document, the next main document in the view is returned. If you send a response document, the next response document with the same parent is returned. If the view is categorized, the next sibling is in the same category as the original document.

Defined in

NotesView

Syntax

getNextSibling(doc:NotesDocument) : NotesDocument
Parameter Description
doc Any document in the view. Cannot be null.
Return value Description
NotesDocument The document following the parameter, at the same level in the view. Returns null if there are no more siblings.

Usage

You can use this method to:
  • Move from one main document to the next, skipping any response documents in between.
  • Visit the response documents of a particular parent document (use getChild to find the first response).
  • Visit the response-to-response documents of a particular parent document (use getChild to find the first response-to-response).
If you filtered the view with FTSearch, this method returns the next document in the view, regardless of level.
Two documents are siblings if:
  • They are both main documents.
  • They are both responses or response-to-responses and they share the same parent document.
This method returns null when the parameter is:
  • The last main document in a view.
  • The last response (or response-to-response) to a particular parent.

Examples

This button gets all the top-level documents in a view.
var v:NotesView = database.getView("main");
var doc:NotesDocument = v.getFirstDocument();
while (doc != null) {
	requestScope.status += "\n" + doc.getItemValueString("subject");
	tmpdoc = v.getNextSibling(doc);
	doc.recycle();
	doc = tmpdoc;
}