LOTUSSCRIPT /COM/OLE のクラス
例:GetNextSibling メソッド
1 次のスクリプトはデータベースの [Main View] で 2 番目の主要文書を取得します。最初の主要文書に返答文書があっても無視します。
[Main View] がカテゴリ別にソートされていて、カテゴリ内の主要文書が「firstMainDoc」だけのときは、ビューの別のカテゴリの他に主要文書がある場合でも、GetNextSibling は Nothing を返します。
[Main View] がカテゴリ別にソートされていて、カテゴリに主要文書が「firstMainDoc」以外にもあるときは、同じカテゴリ内にある次の主要文書を返します。
[Main View] がカテゴリ別にソートされていないときは、GetNextSibling は次の主要文書を返します。
Dim db As New NotesDatabase( "Providence", "buddy.nsf" )
Dim view As NotesView
Dim firstMainDoc As NotesDocument
Dim secondMainDoc As NotesDocument
Set view = db.GetView( "Main View" )
Set firstMainDoc = view.GetFirstDocument
Set secondMainDoc = view.GetNextSibling( firstMainDoc )
2 次のスクリプトは、主要文書のアイテムの値を返答文書のアイテムの値に基づいて計算します。ここでは、返答文書の total アイテムの値をすべて加算して、主要文書の total アイテムに代入する、という計算が行われます。スクリプトによる処理は 1 つの主要文書が終わると次の主要文書へ進み、返答文書も 1 つずつ処理していきます。[Main View] はカテゴリ別にソートされていません。
Dim db As New NotesDatabase( "Cape-Town", "richardj.nsf" )
Dim view As NotesView
Dim parentDoc As NotesDocument
Dim responseDoc As NotesDocument
Set view = db.GetView( "Main View" )
Set parentDoc = view.GetFirstDocument
' Visit each main document in the view
While Not ( parentDoc Is Nothing )
newTotal% = 0
Set responseDoc = view.GetChild( parentDoc )
' Visit each of the parent's response documents
While Not ( responseDoc Is Nothing )
subtotal = responseDoc.GetItemValue( "total" )
newTotal% = newTotal% + Cint( subtotal( 0 ) )
Set responseDoc = view.GetNextSibling( responseDoc )
Wend
' Put the new total onto the parent document
Call parentDoc.ReplaceItemValue( "total", newTotal% )
Call parentDoc.Save( True, False )
Set parentDoc = view.GetNextSibling( parentDoc )
Wend
関連項目
GetNextSibling メソッド
用語集
フィードバック
ヘルプ
または
プロダクトユーザビリティ
?
ヘルプの使い方
すべてのヘルプ項目
用語集