contains (NotesDocumentCollection - JavaScript)

Indicates whether a document collection contains specified documents.

Defined in

NotesDocumentCollection

Syntax

contains(noteid:string) : boolean

contains(noteid:int) : boolean

contains(documents:NotesBase) : boolean

Parameter Description
noteid Note ID of a document.
documents An object of type NotesDocument, NotesDocumentCollection, NotesViewEntry, or NotesViewEntryCollection. View entries must point to documents.
Return value Description
boolean True if this document collection contains the specified document or documents; otherwise false.

Usage

The document or documents whose containment this method determines must be in the same database as the original collection. Otherwise, this method returns the error "the specified note or notes do not exist in the database" or, if a note ID was passed to the method that matches a note ID in the original collection's database, the method uses the unintended document.

If the parameter is an empty collection, this method returns true.

Examples

This button determines if the current document is in the collection resulting from a search.
try {

var noteid:string = currentDocument.getDocument().getNoteID();
var dc:NotesDocumentCollection = database.getAllDocuments();
var query:string = requestScope.query;
if (!query.isEmpty()) {
	query = "\"" + query + "\"";
	database.updateFTIndex(true);
	dc.FTSearch(query);
	if (dc.contains(noteid)) {
		requestScope.status = "Current document contains query";
	} else {
		requestScope.status = "Current document does not contain query";
	}
} else {
	requestScope.status = "No query";
}

} catch(e) {
	requestScope.status = e.message;
}