intersect (NotesViewEntryCollection - JavaScript)

Removes from a view entry collection any entries that do not intersect with specified documents.

Defined in

NotesViewEntryCollection

Syntax

intersect(noteid:string) : void

intersect(noteid:int) : void

intersect(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 that are also contained in the parameter.

Examples

This button gets all documents in a view that match two user search queries.
if (requestScope.query.isEmpty()) return;
if (requestScope.query2.isEmpty()) return;
if (!database.isFTIndexed()) database.createFTIndex(0, false);
var vec1:NotesViewEntryCollection = database.getView("main").getAllEntries();
var vec2:NotesViewEntryCollection = vec1.cloneCollection();
vec1.FTSearch(requestScope.query);
vec2.FTSearch(requestScope.query2);
vec1.intersect(vec2);
if (vec1.getCount() > 0) {
	var entry:NotesViewEntry = vec1.getFirstEntry();
	while (entry != null) {
		requestScope.status += "\n" + 
			entry.getDocument().getItemValueString("subject");
		entry = vec1.getNextEntry(entry);
	}
} else {
	requestScope.status =  "No match";
}