View for the orphan docs?

Is there way to create view for the orphan documents?

Only solution I have found out is to loop through all response documets, check if their parentdocs exists, if not put docs UNID to views selection formula. This takes time and requires user to have access to edit view.

Is there any better way? Some kind of dynamic view?

Subject: View for the orphan docs?

It’s been a while, but we would create an agent that would process through all the response documents and if they were an orphan then stamp a field on them “IsOrphan”. Then only use that field in the selection formula.

We scheduled it to run once a day (at night).

R5 Lotusscript used…

Sub Initialize

Dim ses As New NotesSession

Dim db As NotesDatabase

Dim col As NotesDocumentCollection

Dim doc As NotesDocument

Dim docParent As NotesDocument

Dim update As Variant



Set db = ses.CurrentDatabase

Set col = db.UnprocessedDocuments

If col.Count = 0 Then Exit Sub

Set doc = col.GetFirstDocument

While Not doc Is Nothing

	update = False

	If Len(doc.ParentDocumentUNID) = 32 Then

		Set docParent = db.GetDocumentByUNID(doc.ParentDocumentUNID)

		If docParent Is Nothing Then

			update = True

		Elseif Len(docParent.UniversalID) <> 32 Then

			update = True

		Elseif docParent.UniversalID <> doc.ParentDocumentUNID Then

			update = True

		End If

		If update Then

			doc.FLAG_ISORPHAN = 1

			Call doc.Save(False, True, True)

		End If

	End If

	Set doc = col.GetNextDocument(doc)

Wend

End Sub

Subject: RE: View for the orphan docs?

Thank for response. Your way is better than mine but still I’m looking for more dynamic and up to date way…