getChild (NotesView - JavaScript™)
Given a document in a view, returns the first response to the document.
Defined in
NotesViewSyntax
getChild(doc:NotesDocument) : NotesDocument
Parameter | Description |
---|---|
doc |
Any document in the view. Cannot be null. |
Return value | Description |
---|---|
NotesDocument |
The first response document to the parameter you specify. Returns null if there are no responses to the document. |
Usage
To find additional response documents, use getNextSibling. The combination of getChild and getNextSibling allows you to access document responses sorted in the same order that they appear in a view. To get all the immediate responses for a document unsorted, use getResponses in NotesDocument.If you've filtered the view with the FTSearch method, getChild returns the next document in the view, regardless of level.
Examples
This button gets all the documents in a view arranged hierarchically according the response structure.function getrd(v1, d1, t1) { // recursive to get all response documents
var tabs:string = t1 + "\t";
var child:NotesDocument = v1.getChild(d1);
while (child != null) {
requestScope.status += "\n" + tabs + child.getItemValueString("subject");
getrd(v1, child, tabs);
tmpchild = v1.getNextSibling(child);
child.recycle();
child = tmpchild;
}
}
var v:NotesView = database.getView("main");
var doc:NotesDocument = v.getFirstDocument();
while (doc != null) {
requestScope.status += "\n" + doc.getItemValueString("subject");
getrd(v, doc, "");
tmpdoc = v.getNextSibling(doc);
doc.recycle();
doc = tmpdoc;
}