cloneCollection (NotesDocumentCollection - JavaScript)

Returns a collection object that is a copy of the original collection.

Defined in

NotesDocumentCollection

Syntax

cloneCollection() : NotesDocumentCollection

Examples

This button gets a collection of all documents in the current database and clones it. The first collection is then reduced to one document by a search. That document is used in the cloned collection to get the previous and next documents.
var dc:NotesDocumentCollection = database.getAllDocuments();
var clone:NotesDocumentCollection = dc.cloneCollection();
var query:string = requestScope.query;
if (!query.isEmpty()) {
	query = "\"" + query + "\"";
	database.updateFTIndex(true);
	dc.FTSearch(query, 1);
	var doc:NotesDocument = dc.getFirstDocument();
	if (doc != null) {
		requestScope.status = "";
		var doc2:NotesDocument = clone.getDocument(doc);
		var doc1:NotesDocument = clone.getPrevDocument();
		var doc3:NotesDocument = clone.getNextDocument();
		if (doc1 != null) {
			requestScope.status += 
				"\nPrevious: " + doc1.getItemValueString("subject");
		}
		if (doc2 != null) {
			requestScope.status += 
				"\n" + doc2.getItemValueString("subject");
		}
		if (doc3 != null) {
			requestScope.status += 
				"\nNext: " + doc3.getItemValueString("subject");
		}
	} else {
		requestScope.status = "No hit"
	}
} else {
	requestScope.status = "No query"
}