1
votes

I am trying to merge two notesdocumentcollections together using the following code in a repeat control (Domino 8.5.3):

var tempDC:NotesDocumentCollection = resourceDB.getProfileDocCollection("temp");

if (otherImgDC.getCount() > 0) {
    tempDC.merge(otherImgDC);
    print(otherImgDC.getCount() + ", " + tempDC.getCount());
}

if (techDiagramDC.getCount() > 0) {
    tempDC.merge(techDiagramDC);
}

return tempDC;

But the print statement returns 0 for tempDC.getCount() - what am I missing here? Any help would be appreciated.

2
This could be an issue with recycling of the Domino objects involved.Declan Lynch
It works if I merge existing collection with some documents in the collection, but doesn't work with empty collection, I even tried resourceDB.createDocumentCollection, but still the same issue.pipalia

2 Answers

1
votes

Fixed the problem. although would still like to know why merge doesn't work with empty collection:

if (otherImgDC.getCount() > 0) {
    if (techDiagramDC.getCount() > 0) {
        otherImgDC.merge(techDiagramDC);
    }

    return otherImgDC;
} else {
    if (techDiagramDC.getCount() > 0) {
        return techDiagramDC;
    }
}
0
votes

Did you check the collections before the merge? All 3 of them? And for the fun of it: move them to a Java class you call from the SSJS.