I have a list of document in view. I also have a button inside view where I can create new document with value from existed document. For this new document, I will use different form for new document created. In my view, document is divide by Status. I also has dialogBox too for me to set batchNo for new documents.
So, the process is like this:
- First, I will select document based on it status. So let's say I have 5 documents under "Spoilt" status, I can choose how many document I want. So I choose 2 documents only.
- After document selected, I will click button to create one new documents using lotusscript. After button clicked, DialogBox will show. I insert batchNo and click OK.
- Then, the code will check that status of documents and create new document by getting value from 3 documents and display into new document.
- For example, I need to get value from field "PSerialNo" and "PType" from 2 documents. As you can see below. Value from document1 and document2, I want to insert in new document. So if document1, PSerialNo into WSerialNo1 and PType into WType1. And if document2, PSerialNo into WSerialNo2 and PType into WType2 and so on.
Document 1
Document 2
New Document
This is my code to create new document.
Set doc = dc.GetFirstDocument()
While Not (doc Is Nothing)
If doc.PStatus(0) = "Active" Then
Set newdoc = New NotesDocument(db)
newdoc.Form = "WriteOff"
newdoc.WABatchNo = wDialogDoc.WBatchNo(0)
newdoc.WType = doc.PType(0)
newdoc.WSerialNo = doc.PSerialNo(0)
newdoc.ComputeWithForm(False,False)
newdoc.save(True,False)
End If
doc = dc.GetNextDocument(doc)
Wend
My problem now, if I create new document, and I want to get value from two documents, it not insert into one new document but it insert into two different new document. How can I fix it. Any advice or help I appreciate. Thanks!