0
votes

Before this I have post a question regarding my problem but still no answer. I will try again to post question about my problem in here. I will update new code and explaination about it. Before this I have done with dialog box, but I have been asked to change it, just use form in view.

My process start with open a form in view to set a new batch info. the form name is PCBatchInfo. In this form, I have 4 field which is BBatchNo, BInspector, BStart, and BEnd. Then in this form I have a button. When I click this button, it will do three process which is:

  1. Create new batch info and save. This is current open document. I call this "dialogDoc".
  2. Then, create a copy of Computer document. In this copy, it will replace BBatchNo as I created just now. I call this copy document as "newdoc" and original document as "doc"
  3. After that, I create new report document and copy value from Computer document. Then I will get value from set batch no which is BInspector, BStart, and BEnd and insert into this report I call this "repdoc".

Below here my lotusscript in my button

Set db = session.CurrentDatabase

Set uidoc = ws.CurrentDocument
Set dialogDoc = uidoc.Document
Set view = db.GetView("Computer")

Set doc = view.GetFirstDocument
If doc.PStatus(0) = "Lock" Then
    Msgbox "Complete PC Inspection first!"
    Exit Sub
Else
    '--set new batch info--'
    dialogDoc.Form = "PCBatchInfo"
    Call uidoc.FieldSetText("SaveOptions", "1")
    Call uidoc.Save

    answer% = Messagebox("Please confirm", 4,"Batch Number")    
    If answer% = 6 Then
        While Not (doc Is Nothing)
            If doc.PStatus(0) = "Active" Then

            '--create new copy document--'
            Set newdoc = doc.CopyToDatabase (db)
            newdoc.DocumentId = doc.UniversalID
            newdoc.PBatchNo = dialogDoc.BBatchNo(0)
            Call newdoc.Save(True, False)

            '-- set new acceptance form --'
            Set repdoc = New NotesDocument (db)
            repdoc.Form = "EmpPCSpec"

            repdoc.ABatchNo = doc.PBatchNo(0)
            repdoc.AStatus = doc.PStatus(0)
            repdoc.ATagNo = doc.PTagNo(0)
            repdoc.AFStatus = doc.PFStatus(0)
            repdoc.AInspector = dialogDoc.BInspector(0)              
            repdoc.AStart = dialogDoc.BStart(0)
            repdoc.AEnd = dialogDoc.Bend(0)

            Call repdoc.ReplaceItemValue("AStatus", "Incomplete")
            Call repdoc.ComputeWithForm(False,False)
            Call repdoc.save(True,False)

            doc.PStatus = "Lock"
            Call doc.ComputeWithForm(False,False)
            Call doc.save(True,False)
            End If
            Set doc = view.GetNextDocument(doc) 
        Wend
    End If
End If

All this process I run on one button. So when I run this button, I have success to create new batch info, I can create copy of document, and I can create report document. But the problem now are in copy document, it did not display BBatchNo. And in report document, it did not display BInspector, BStart, and BEnd that I want to get from PCBatchInfo form. The field left empty. I hope my explaination is clear about my problem. Any help from you guys I appreciated. Thanks!

Update Question

For all information save for new batch info using PCBatchInfo, the view is on (PCBatch). How can I get the value in this view? I only get value from "Computer" where it save Computer document.

1

1 Answers

1
votes

I think your problem is right here

Set dialogDoc = New NotesDocument(db)

You carefully got the document object from the current UIDoc and then overwrote it with a new (blank) document.