例: Subtract method

この例では、現在のデータベースから、明日のフォローアップ日付を持ったすべてのアクティブなフォローアップフォームを検索し、低い優先順位文書に現在から 2 ヵ月後までのフォローアップ日付を割り当て、残りの文書に次の月までのフォローアップ日付を割り当てます。

Sub Initialize
  Set session = New NotesSession     
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim dc1 As NotesDocumentCollection
  Dim dc2 As NotesDocumentCollection
  
  searchFormula$ = {Form = "Followup" & Status = "Active" & @Date(FollowupDate) <= @Tomorrow}
  Set dc1 = db.Search(searchFormula$, Nothing, 0)
  
  ' all these docs need to have followup deadlines extended,
  ' but not all by the same amount.
  Set dc2 = dc1.Clone()
  ' limit dc2 to only low-priority docs -- longer deadline.
  Call dc2.FTSearch( { [priority] = "Low" }, 0)
  ' and remove those low-priority ones from dc1 
  Call dc1.Subtract(dc2)
  
  Dim nextmonth As New NotesDateTime( "" )
  Call nextmonth.SetNow
  Call nextmonth.AdjustMonth( 1 )
  Call dc1.StampAll("FollowupDate", nextmonth)
  
  Dim twoMonths As New NotesDateTime("")
  Call twoMonths.SetNow
  Call twoMonths.AdjustMonth( 2 )
  Call dc2.StampAll("FollowupDate", twoMonths)
End Sub