コレクション内の指定された位置にある文書を取得します。
パラメータ | 説明 |
---|---|
n | 返される文書の位置を示す番号。 1 はコレクションの最初の文書、2 は 2 番目の文書というように文書を示します。 |
戻り値 | 説明 |
---|---|
NotesDocument | コレクション内の n 番目の位置にある文書。 指定された位置に文書がない場合は、NULL を返します。 |
パフォーマンス上の理由から、getNthDocument と getCount を組み合わせてループを繰り返すことは避けてください。お勧めするループ構造については、getNextDocument と getPrevDocument を参照してください。
var dc:NotesDocumentCollection = database.getAllDocuments();
var n:int = sessionScope.documentNumber;
if (dc.getCount() > 0) {
if (n == null || n == dc.getCount()) {
n = 1;
} else {
n++;
}
var doc:NotesDocument = dc.getNthDocument(n);
requestScope.status = doc.getItemValueString("subject");
doc.recycle();
sessionScope.documentNumber = n;
}
Java™ DocumentCollection クラスの getNthDocument メソッド