Re-associate children docs to their respective parent doc by a field value.

This was used to re-associate "database access profiles" to each user's "user profile"
LotusScript


Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim collect As notesdocumentcollection
Set collect = db.unprocesseddocuments
If collect.count = 0 Then Exit Sub
	
Dim pdoc As notesdocument
Dim cdoc As notesdocument
Set cdoc = collect.getfirstdocument
Dim pview As notesview
Set pview = db.getview("CCLUBUID")
Dim counter As Integer
	
Do
	If cdoc.form(0)="DBAP" Then
		Set pdoc = pview.getdocumentbykey( cdoc.up_uniqueID(0) , True)
		If Not pdoc Is Nothing Then
			Call cdoc.MakeResponse( pdoc )
			Call cdoc.save(True,True)
			counter = counter + 1
		End If
	End If
	Print counter & " docs matched so far."
	Set cdoc = collect.getnextdocument(cdoc)
Loop Until cdoc Is Nothing

Posted by fbrefere001 on Thursday February 23, 2006