0
votes

I have a form called PCBatchInfo. In this form, there only have 4 field which is BatchNo, Inspector, Start date, and End Date. I will then open this form and insert the information.

On other side, I have Computer form with many field which is use to show all document in view.

PCBatchInfo and Computer form have same field which is PBatchNo. So, what I will do is, I insert BatchNo in PCBatchInfo. Then when I save it, it will also change BatchNo for all Computer document.

I want to open new PCBatchInfo form in dialogbox in view. As I do some research, dialogbox only can open existing document using Queryopendocument.

Let's say, I click button in view then it will show dialogbox with PCBatchInfo form. I insert all information required, then save. Can I open this form using dialogbox from view using a button?

UPDATE

I have found a way to use dialogbox but couldn't get to save the form. Code is as below.

varResult = ws.DialogBox("PCBatchInfo", True, True, False, False, True, False, "Please insert all information below", dialogDoc, False, False, True)
    If varResult Then
        batchValue = dialogDoc.BBatchNo(0)
        inspectorValue = dialogDoc.BInspector(0)
        dateValue1 = dialogDoc.BStart(0)
        dateValue2 = dialogDoc.Bend(0)
    End If

Can anyone help me how can I save form from dialogBox? Thanks in advance!

2
Just to check that I understand your problem: with the button, do you want to open a dialog box, using the PCBatchInfo form, and when the user clicks OK you want to save the data as a new document? That can be done.D.Bugger
Hello D.Bugger, yes it kinda like that. I have sent my message through your twitter DM.Reinhaa

2 Answers

2
votes

In pseudo code:

Set dbdoc= New NotesDocument(db)
Rv= ws.DialogBox(....., dbdoc, ...)
If user clicked Ok then
    Dbdoc.Form= "YourFormName"
    Dbdoc.Save
Fi

So you create a new NotesDocument before calling DialogBox, you can initialize fields there if you want, then the DialogBox opens, and when it is closed you have to check the return value. If the user clicked Ok, you have to complete the document yourself, by setting Form explicitly, and maybe some other things, and then you can save the document.

2
votes

In order to use the dialogBox you need to have a document. This document needs to only in memory. Before and after the call to DialogBox you can do what every you like with that document. You can also set a Form field. The form is only used to display the data. The document contains the data, and can be changed or just simply saved.

If you want to show the dialogbox from the selected document in the view then look at NotesUIView.caretNoteId which returns the NoteID of the current selected document.