intersect (NotesNoteCollection - JavaScript)

Creates a note collection containing the notes common to the original collection and the note or notes specified in the intersection parameter.

Defined in

NotesNoteCollection

Syntax

intersect(removalspecifier:NotesAgent) : void

intersect(removalspecifier:NotesDocument) : void

intersect(removalspecifier:NotesDocumentCollection) : void

intersect(removalspecifier:NotesForm) : void

intersect(removalspecifier:int) : void

intersect(removalspecifier:NotesNoteCollection) : void

intersect(removalspecifier:string) : void

intersect(removalspecifier:NotesView) : void

Parameter Description
removalspecifier The note to be intersected. For int and string, the note ID; otherwise the associated object.

Usage

The parent databases of the note collections must be the same.

Examples

This button builds a note collection of documents from the current database. It removes any document with a subject containing the text "example" then exports the revised collection as DXL.
// Open DXL file
var stream:NotesStream = session.createStream();
var filename:string = "c:\\dxl\\";
filename = filename + database.getFileName();
filename = filename.substring(0, filename.length() - 3) + "dxl";
if (stream.open(filename)) {
	requestScope.status = "Opened " + filename;
	stream.truncate();

	// Create note collection
	var nc:NotesNoteCollection = database.createNoteCollection(false);
	nc.setSelectDocuments(true);
	nc.buildCollection();
	
	// Keep notes that meet search
	var dc:NotesDocumentCollection = database.FTSearch(requestScope.query);
	if (dc.getCount() > 0) {
		nc.intersect(dc); // this crashing - not sure why
	}

	// Export note collection as DXL
	var exporter:NotesDxlExporter = session.createDxlExporter();
	var output:string = exporter.exportDxl(nc);
	stream.writeText(output);
	stream.close();
	requestScope.status = requestScope.status + "\n" + nc.getCount() +
		" notes written to " + filename;
} else {
	requestScope.status = "Cannot open " + filename;
}