IBM Lotus DominoではJavaエージェントを構築しました。また、分類されID_Order:DocumentCollectionの数は5ですが、1つのドキュメントのみを取得します
View orderLinesView = CurrentDatabase.getView("OrderLinesOnId");
ビューがソートされた列があります。このエージェントでは、私は注文ラインを持っているビューを取得しています。
私は同じID_Orderとビューのすべての文書を取得するには、次のでした
Vector keyRegel = null;
keyRegel = new Vector();
keyRegel.add(orderDocument.getItemValueString("ID_Order"));
DocumentCollection orderLineCollection = orderLinesView.getAllDocumentsByKey(keyRegel, true);
は今、私はすべてのドキュメントをループしたいと説明印刷:ランニングで
System.out.println("Count orderRegelcollection:" +
Document orderLineDocument = orderLineCollection.getFirstDocument();
while (orderLineDocument != null) {
System.out.println("description " + orderLineDocument.getItemValueString("description"));
orderLineDocument = orderLineCollection.getNextDocument();
}
をそれは1文書を印刷し、最初のループの後に終了します。しかし、私の見解では、同じID_Orderを持つ5つの文書がはっきりと分かります。 (私はID_Orderで検索する場合)奇妙なことが
完全なコードは次のようである、それはビューにのみ最後の文書を取ることです。
View relationsView = dbRelatie.getView("Relations");;
Document relationDocument = relationsView.getFirstDocument();
while (relationDocument != null) {
Vector key = null;
key = new Vector();
key.add("");
key.add(relationDocument.getItemValueString("getDebtor"));
DocumentCollection orderDocumentCollection = TotalOrdersView.getAllDocumentsByKey(key, true);
Document orderDocument = orderDocumentCollection.getFirstDocument();
while (orderDocument != null) {
そして私が得ます
彼は)(私はorderLineCollection.getNextdocumentを持っていた申し訳ありませんいや。私は間違って質問にそれを入力..そして、なぜ私は100.000 +のドキュメントを介してループをしたくないためgetAllDocumentsByKeyを使用する理由 – YdB
問題はありません。 :)これは、あなたが 'getAllDocuments()'や 'getDocumentByKeys()'のどちらかを使ってドキュメントコレクションを作ることができたと言った理由です。コレクションオブジェクトは次のドキュメントをループ、私は上記の方法で。 –
:)返信ありがとう、私はorderLineCollection.getNextDocument()を持っています。しかし、私は最後の文書しか入手しません。だから私はビューでそれを見て5を参照してくださいしかし、私は最後を得る – YdB