LOTUSSCRIPT /COM/OLE のクラス
例:QuerySave イベント
1. 次のスクリプトは [Title] フィールドが空のとき現在の文書が保存されないようにします。スクリプトはメッセージを表示して挿入点を [Title] フィールドに置きます。
Sub Querysave(Source As Notesuidocument, _
Continue As Variant)
If ( source.FieldGetText( "Title" ) = "" ) Then
Messagebox( "You must enter a title.")
Call source.GotoField( "Title" )
continue = False
End If
End Sub
2. 次のスクリプトは現在の文書が保存されるとき、[dueDate] フィールドの内容を確認して、内容に応じて [ProjectStatus] フィールドを更新します。[dueDate] が 3 日以内のとき、スクリプトは [ProjectStatus] フィールドに「Urgent」を入力します。また、5 日以内のときは「Hurry up a little」、6 日または 7 日前の場合「No worries」をフィールドに入力します。
Sub Querysave(Source As Notesuidocument, _
Continue As Variant)
Dim targetDate As String
Dim todayDateTime As NotesDateTime
Dim dueDateTime As NotesDateTime
Dim daysLeft As Long
Call source.Refresh
Set todayDateTime = New NotesDateTime( "Today" )
Set dueDateTime = New NotesDateTime _
( source.FieldGetText( "dueDate" ) )
daysLeft = ( dueDateTime.TimeDifference _
( todayDateTime ) ) / 86400
Select Case daysLeft
Case 1, 2, 3:
status = "Urgent"
Case 4, 5, 6:
status = "Hurry up a little"
Case 6, 7:
status = "No worries"
End Select
Call source.FieldSetText( "ProjectStatus", status )
End Sub
関連項目
QuerySave イベント
用語集
フィードバック
ヘルプ
または
プロダクトユーザビリティ
ヘルプの使い方
すべてのヘルプ項目
用語集