merge (NotesViewEntryCollection - JavaScript)

Adds to a view entry collection specified documents not already in the collection.

Defined in

NotesViewEntryCollection

Syntax

merge(noteid:string) : void

merge(noteid:int) : void

merge(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 entry or entries 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 document collection contains a union of its documents and those specified by the parameter.

Examples

This button gets all documents in a view that match either of 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.merge(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";
}