contains (NotesViewEntryCollection - JavaScript)

Indicates whether a view entry collection contains specified documents.

Defined in

NotesViewEntryCollection

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 view entry 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 puts in a folder documents found through a search minus the current document.
if (requestScope.query.isEmpty()) return;
if (!database.isFTIndexed()) database.createFTIndex(0, false);
var vec:NotesViewEntryCollection = database.getView("main").getAllEntries();
vec.FTSearch(requestScope.query);
if (vec.getCount() > 0) {
	var doc:NotesDocument = currentDocument.getDocument();
	var entry:NotesViewEntry = vec.getEntry(doc);
	if (vec.contains(entry)) {
		vec.deleteEntry(entry);
	}
	vec.putAllInFolder("searchResults", true);
	requestScope.status =  "Document(s) put in folder";
} else {
	requestScope.status =  "No match";
}