Examples: Clone method (NotesDocumentCollection - LotusScript®)

This example searches the current database for all active followup forms with a followup date of tomorrow, assigns the low priority documents a followup date of two months from now, and the rest of the documents a followup date of next month.

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