Doc.makeresponse problem!

The following code works, and the resulting response documents use a form that is of type “Response,” and the response documents also have the correct $REF, and the view correctly displays response docs in a response hierarchy. BUT, the resulting response docs are being saved as parent docs, and they are not showing up underneath the parent! Here is the code. HELP! I’ve used doc.makeresponse quite a few times successfully, too!

Dim thisdb As notesdatabase

Dim regdb As notesdatabase

Dim orgview As notesview

Dim session As notessession

Dim thisdoc As NotesDocument

Dim regdoc As notesdocument

Dim orgdoc As notesdocument

Dim coll As NotesDocumentCollection

Set session = New notessession



Set thisdb = session.currentdatabase

Set regdb = New NotesDatabase("IDXNET/BOSTON/IDX1", "IUC\UCReg2005.nsf")



Set coll = thisdb.UnprocessedDocuments

Set orgview = regdb.GetView("Clients")

Set orgdoc = orgview.GetDocumentByKey("IDX",True)



For i = 1 To coll.Count

	Set thisdoc = coll.GetNthDocument(i)

	Set regdoc = regdb.CreateDocument

	regdoc.Form = "STAFF"

	regdoc.StaffName = thisdoc.StaffName

	regdoc.ENUMBER = thisdoc.ENUMBER

	

	Call regdoc.MakeResponse(orgdoc)

	Call regdoc.ComputeWithForm(True,False)

	Call regdoc.Save(True,False)

Next i

Subject: doc.makeresponse problem!

Hi Tricia,

Two things:

  1. flag = notesDocument.Save( force, createResponse [, markRead ] )

In your save method, you are setting createresponse to false.

  1. If number 1 above doent do it …As a test try removing the line to ComputeWithForm, and see if it works. There could be something that you are doing in the form that affects the hierarchical nature.

Subject: RE: doc.makeresponse problem!

Actually, #1 doesn’t have anything to do with it. That param is only used in dealing with replication/save conflicts. It will not negate the explicit use of doc.makeresponse.

Subject: RE: doc.makeresponse problem!

I tried calling regdoc.Save(True,True)… nada. Then I commented out regdoc.ComputeWithForm(True,False) and still the hierarchy is messed up. :slight_smile:

Subject: doc.makeresponse problem!

DUH!!! I apologize, but doc.makeresponse was working perfectly well!! My view was relying on a field to properly categorize, and I forgot to set that field! Sorry! Here is the resulting code, which works very well!

Sub Initialize

Set session = New notessession



Set thisdb = session.currentdatabase

Set regdb = New NotesDatabase("IDXNET/BOSTON/IDX1", "IUC\UCReg2005.nsf")



Set coll = thisdb.UnprocessedDocuments

Set orgview = regdb.GetView("Clients")

Set orgdoc = orgview.GetDocumentByKey("IDX",True)



For i = 1 To coll.Count

	Set thisdoc = coll.GetNthDocument(i)

	Set regdoc = regdb.CreateDocument

	regdoc.Form = "STAFF"

	regdoc.StaffName = thisdoc.UC_AllIDXPresenters

	regdoc.ENUMBER = thisdoc.ENUMBER

	regdoc.CIS_CustMne = "IDX"  'needed to categorize the view

	regdoc.CIS_CustNm = "IDX Systems Corporation"

	

	Call regdoc.MakeResponse(orgdoc)

	Call regdoc.ComputeWithForm(True,False)

	Call regdoc.Save(True,False)

Next i

End Sub