Create a doc for each value in a specific field from every document selected in the view.

This code will create a new DLE form for each value in the specified field, for every document that is selected in the view.
Lotus Notes View • LotusScript

Sub Click(Source As Button)
	Dim workspace As New NotesUIWorkspace
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Set db = session.CurrentDatabase
	Dim sdoc As NotesDocument
	Dim doc As NotesDocument
	Dim SourceFieldValues As Variant
	Dim collect As NotesDocumentCollection
	Set collect = db.UnprocessedDocuments
	Set sdoc = collect.GetFirstDocument
		SourceFieldValues = sdoc.GetItemValue("OfficeName")
		For J = 0 To Ubound(SourceFieldValues)
			Set doc = db.CreateDocument
			doc.Form = "DLE"
			doc.dl_entry = SourceFieldValues(J)		
			Call doc.Save(True, True)
		Next J
		Set sdoc = collect.getnextdocument(sdoc)
	Loop Until sdoc Is Nothing

	Msgbox "Done"
End Sub

Posted by fbrefere001 on Friday March 8, 2002