2012-03-11 213 views
1

我試圖合併兩個notesdocumentcollections一起在重複控制使用下面的代碼(多米諾8.5.3):重複控制合併notesdocumentcollection

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; 

但打印語句tempDC.getCount()返回0 - 我在這裏錯過了什麼?任何幫助,將不勝感激。

+1

這可能是回收涉及的Domino對象的問題。 – 2012-03-12 05:42:02

+1

它的工作原理是,如果我將現有集合與集合中的某些文檔合併在一起,但不能用於空集合,我甚至嘗試過resourceDB.createDocumentCollection,但仍然是同樣的問題。 – pipalia 2012-03-12 09:55:59

回答

1

修復了這個問題。雖然仍然想知道爲什麼合併不適用於空集合:

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

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

你在合併之前檢查了集合嗎?他們全部3個? 爲了它的樂趣:將它們移動到您從SSJS調用的Java類。

+0

在合併之前和之後檢查了所有3個集合。我想我找到了一個解決方案,而沒有轉移到Java現在的作品,將在這裏發佈答案。 – pipalia 2012-03-12 09:56:55