文書を更新する(NotesDocument クラス)

Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim doc As NotesDocument
	Dim view As NotesView
	Dim key As String
	Set db = session.Currentdatabase
	Set view = db.GetView("vwAll")
	key = "L01"
	Set doc = view.GetDocumentByKey(key, True)
	If Not(doc Is Nothing) Then
		doc.Price = doc.Price(0) * 2
		Call doc.Save(True, True)
	Else
		Print "一致する文書が見つかりませんでした。"
	End If	
End Sub





LotusScript 入門 Step4-2 NotesDocument クラス

12行目 “doc.(フィールド名) = (設定値)”で値を設定可能(「拡張クラス」構文)。[価格(Price)]フィールドは複数値ではないが、フィールドのデータは複数値を前提として配列で返ってくる。そのため、後に“(0)”を付けて配列の最初の値を取得して2を掛ける
13行目 NotesDocument クラスの Save メソッドを使用して、変数 doc を保存。保存を忘れないようにすること

LotusScript
tyoshida
April 30, 2018 at 1:33 PM
Rating
0





No comments yetLogin first to comment...