getNextDocument (NotesDocumentCollection - JavaScript)

コレクション内にある現在の文書または指定された文書の、次の文書を取得します。

定義場所

NotesDocumentCollection

構文

getNextDocument() : NotesDocument

getNextDocument(doc:NotesDocument) : NotesDocument

パラメータ 説明
doc コレクション内の任意の文書。NULL にすることはできません。
戻り値 説明
NotesDocument パラメータを指定しない場合は、現在の文書の次の文書を返します。パラメータを指定した場合は、指定された文書の次の文書を返します。次の文書がない場合は NULL を返します。

使用法

お勧めするループ構造は、NULL が返されるまで getFirstDocument() とそれに続けて getNextDocument() を使用する方法です。パフォーマンス上の理由から、getNthDocument(n:int)getNextDocument(doc:NotesDocument) をループ内で使用しないでください。

ループ内で文書を取得すると、動的メモリをすぐに使い尽くしてしまいます。 メモリ問題を避けるには、var tmpdoc = getNextDocument(); doc.recycle(); doc = tmpdoc のようなシーケンスを使用して、反復ごとに NotesDocument オブジェクトをリサイクルします。

このボタンは、現在のデータベース内にある文書をすべて取得します。
var dc:NotesDocumentCollection = database.getAllDocuments();
var doc:NotesDocument = dc.getFirstDocument();
while (doc != null) {
	requestScope.status += "¥n" + doc.getItemValueString("subject");
	var tmpdoc:NotesDocument = dc.getNextDocument();
	doc.recycle();
	doc = tmpdoc;
}
以下のボタンは、現在のデータベース内にある 2 番目の文書を取得します。
var dc:NotesDocumentCollection = database.getAllDocuments();
if (dc.getCount() > 1) {
	var doc:NotesDocument = dc.getNextDocument(dc.getFirstDocument());
	requestScope.status = doc.getItemValueString("subject");
	doc.recycle();
}

言語間の参照

LotusScript® NotesDocumentCollection クラスの GetNextDocument メソッド

Java™ DocumentCollection クラスの getNextDocument メソッド