This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Oct 10, 2013, 10:15 AM
12 Posts
topic has been resolvedResolved

Merge Collection from different Databases

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 9.0
  • Role: Developer
  • Tags:
  • Replies: 1
Hi,
 
is it possible to merge multiple Collections from different Databases (doesnt matter wheater DocumentCollection or ViewEntryCollection) ?
 
In my case I loop over multiple databases and search for users (ftsearch).
 
In the designer help i read that it isn't possible to merge DocumentCollection from different databases ?
 
Code Example:
var resultCollection:NotesDocumentCollection = null;
 
var books:java.util.Iterator = sessionAsSignerWithFullAccess.getAddressBooks().iterator(); 
 
while (books.hasNext() | maxquery>200) {
var AdrDB:NotesDatabase = books.next();
var AdrDBserver:string = AdrDB.getServer().toLowerCase();
var AdrDBpath:string = AdrDB.getFilePath().toLowerCase();
 
var AdrDBDir:NotesDatabase = sessionAsSignerWithFullAccess.getDatabase(AdrDBserver, AdrDBpath);
 
var result:NotesDocumentCollection = AdrDBDir.getAllDocuments();
 
result.FTSearch(searchstr)
 
if(result.getCount()>0){
 
         maxquery =+ result.getCount();
 
         if(resultCollection==null)
               resultCollection = result.cloneCollection();
        else
              resultCollection.merge(result.cloneCollection());
}
 
result.recycle();
AdrDBDir.recycle();
 
 
}

 

thanks for your help

Oct 10, 2013, 6:00 PM
586 Posts
hmmm

I think the was to fairly easily do this is with Java.

You create a Java Object to represent a person.  You create a JavaObject to hold your collection.  you go find the people from whereever - inject them into the people objects then store the new java person object inside a java ArrayList or something in your new Java collection.  You're just not using a true domino collection object which is no big deal anyway.

If you're not into Java...  I would think that you could still do something similar...  have a SSJS function...  create inside a new ArrayList...  do find all your documents...  putting them into that array list...  feed to a repeat control...  I think it should be fine as long as you don't try to put the arraylist in scope or anything like that.  Since it would contain domino document objects at that point.

Just my quick thoughts...

Dave


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal