Parent document no getting created

Lotus Domino
Well following is the requirement. There is a proposal which could be of one or multiple pages .In the case of multiple pages those documents are the response documents. In future if there a similar kind of proposal to be sent then the user clicks another button so that a copy of the same can be created .The code that I have currently creates only the first document and not those response document i.e those extra pages .Hence I created a view where I am capturing only the responses and in the first categorized column in the view I am looking at the $ REF field , so that I first get the Parentdocumentuind and for all instances of those $ Ref create as many as documents .Now the problem is again the code is not creating the new parent document and its creating only the reponse documents . Following is the code . Sub Click(Source As Button) Dim workspace As New NotesUIWorkspace Dim session As New NotesSession Dim db As NotesDatabase Dim uidoc As NotesUIDocument Dim view As NotesView Dim SNview As Notesview Dim collection As NotesDocumentCollection Dim docA As NotesDocument Dim docB As NotesDocument Dim docC As NotesDocument Dim docD As NotesDocument Dim SNdoc As NotesDocument Dim count As Integer Dim item As NotesItem Set db = session.CurrentDatabase Set uidoc = workspace.CurrentDocument Set docA = uidoc.Document Set view = db.GetView("(OLUResp)") Set SNview = db.getview("(OLU1)") Set collection = view.GetAllDocumentsByKey(Cstr(docA.UniversalID)) 'Set collection = view.GetAllDocumentsByKey (Cstr(docA.ParentDocumentUnid)) 'create new parent If Not (docA Is Nothing) Then Set docB = New NotesDocument( db ) Call docA.CopyAllItems( docB, True ) docB.Sale_Num= Trim(Str$(Val(docA.Sale_Num(0))+1)) docB.Author = session.CommonUserName Call docB.RemoveItem( "SaveOptions" ) docB.Signature = "" docB.PrintedSig = "" docB.Quote_Date = Evaluate ("@Now") docB.S = "" Call docB.Save( True, True ) End If 'create new response docs count = collection.Count If collection.Count > 0 Then Set docD = collection.GetFirstDocument() Set SNdoc = SNview.getfirstdocument While count > 0 Set docC = New NotesDocument( db ) Call docD.CopyAllItems( docC, True ) 'docC.$REF = docB.ParentDocumentUnid Set item = docC.ReplaceItemValue( "$REF", docB.UniversalID ) docC.Sale_Num= Trim(Str$(Val(SNdoc.Sale_Num(0))+1)) docC.Author = session.CommonUserName Call docC.RemoveItem( "SaveOptions" ) docC.Signature = "" docC.PrintedSig = "" docC.Quote_Date = Evaluate ("@Now") docC.S = "" Call docC.Save( True, True ) count = count - 1 Set docD = collection.GetNextDocument(docD) Wend End If

Answer Wiki

Thanks. We'll let you know when a new response is added.

When you step through the code with the debugger, what line fails?

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: