Dim doc As NotesDocument
Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "ProjectDescription" )
If ( rtitem.Type = RICHTEXT ) Then
Call rtitem.AppendText( "Before" )
Call rtitem.AddTab( 2 )
Call rtitem.AppendText( "After" )
Call doc.Save( False, True )
End If
スクリプトの開始時に ProjectDescription アイテムが空の場合、スクリプトが終了すると次のようになります。
Before After
Dim targetDoc As NotesDocument
Dim targetRTItem As NotesRichTextItem
'...set value of targetDoc...
Set targetRTItem = New NotesRichTextItem _
( targetDoc, "ProductListing" )
Dim sourceDb As NotesDatabase
Dim sourceView As NotesView
Dim sourceDoc As NotesDocument
Set sourceDb = New NotesDatabase( "Belem", "inventry.nsf" )
Set sourceView = sourceDb.GetView( "Products" )
Set sourceDoc = sourceView.GetFirstDocument
While Not ( sourceDoc Is Nothing )
a = sourceDoc.ColumnValues( 0 )
b = sourceDoc.ColumnValues( 1 )
Call targetRTItem.AppendText( a )
Call targetRTItem.AddTab( 1 )
Call targetRTItem.AppendText( Str( b ) )
Call targetRTItem.AddNewLine( 1 )
Set sourceDoc = sourceView.GetNextDocument( sourceDoc )
Wend
Call targetDoc.Save( False, True )
例えば、INVENTORY.NSF の [Products] ビューが最初の列に製品名を含み、2 番目の列に数量を含んでいる場合、ProductListing アイテムの結果は次のようになります。
Nails, common #08 989
Nails, common #10 1000
Nails, common #12 1000
Nails, common #16 978
Screws, slot, 1/4x2 1000