ビューを列の値を使用して文書を検索する [複数](NotesView クラス/GetAllDocumentsByKey メソッド, NotesDocumentsCollection クラス)

Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim dc As NotesDocumentCollection
	Dim doc As NotesDocument
	Dim view As NotesView
	Dim key As String
	Set db = session.Currentdatabase
	Set view = db.GetView("vwAll")
	key = "L"
	Set dc = view.GetAllDocumentsByKey(key, False)
	Set doc = dc.GetFirstDocument()
	Print "製品 ID が [L] で始まるのは..."
	While Not(doc Is Nothing)
		Print "製品名: " + doc.ProductName(0)
		Set doc = dc.GetNextDocument(doc)
	Wend	
End Sub





LotusScript 入門 Step3-3 NotesView クラス/GetAllDocumentsByKey メソッド, NotesDocumentsCollection クラス

4行目 NotesDocumentCollection クラスの変数 dc を宣言
11行目 NotesView クラスの GetAllDocumentsByKey メソッドを使用して、ビューの左端ソート列(製品 ID の昇順でソート)と第1引数に指定した変数 key が一致する文書をすべて検索。部分一致(前方)で検索する場合、第2引数には、False を指定。戻り値は NotesDocumentCollection オブジェクトであることに注意(複数の文書のコレクション/一覧)
14,17行目 While ステートメントを使用して、変数 doc が Nothing になるまで 14~17行を繰り返す
11行目 NotesDocumentCollection クラスの GetNextDocument メソッドを使用して、変数 doc の次の文書を取得

LotusScript
tyoshida
April 30, 2018 at 2:52 PM
Rating
0





No comments yetLogin first to comment...