subtract (NotesViewEntryCollection - JavaScript)

Removes from a view entry collection specified documents.

Defined in

NotesViewEntryCollection

Syntax

subtract(noteid:string) : void

subtract(noteid:int) : void

subtract(documents:NotesBase) : void

Parameter Description
noteID Note ID of a document.
documents An object of type NotesDocument, NotesDocumentCollection, NotesViewEntry, or NotesViewEntryCollection. View entries must point to documents.

Usage

The document or documents being applied by this method 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.

On successful completion of this method, the original view entry collection contains only the entries it contained prior to the call not specified by the input argument.

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();
	if (doc != null) vec.subtract(doc);
	vec.putAllInFolder("searchResults", true);
	requestScope.status =  "Document(s) put in folder";
} else {
	requestScope.status =  "No match";
}