Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Update a field on a Open doc from another open doc

Posted on 2004-09-02
12
Medium Priority
?
264 Views
Last Modified: 2013-12-18
Hi Guys


So

I know how to open and populate fields between two databases. No problem

Problem

I have a form open

Push a button it launches a form within the same database
I now have two documents open
When a button is pushed on the most recently opened doc I need it update a field on the document that is lurking in the backgroud. The document would then close and leave the main document to be completed
0
Comment
Question by:imjamesw
  • 6
  • 5
12 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11963391
Maybe easy enough: communication is possible, because the parent of the newly opened form can use the uidoc of that form.

See ws.editdocument, how it kan return the uidoc of the new form
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11965645
Is this a web application?
0
 

Author Comment

by:imjamesw
ID: 11968152
No this is a notes application
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11970829
Then read the Help about the EditDocument method of NotesUIWorkspace. It makes it possible that a LotusScript function on a parent form interferes directly with the newly edited form.The other way round is not possible, the child form cannot set values in the parent form in any way. Some examples of using this technique:

Edit the child document, use the returned uidoc to set the name of an Environment variable that contains the UniversalID of the current document. If both forms are to be open at the same time, this won't work, because only the database document will be updated, not the parent form on screen.

Edit the child document, use the returned uidoc to set a (hidden) field with a state, the states being
NOTATTACHED (default state): if the form is used without having been opened by the parent, there is no data exchange required
ATTACHED: requests the child form to set the state to UPDATED whenever the content of some fields have been changed
UPDATED: signals the parent form that fields have been updated, to be copied to the parent form; the state could be reset to ATTACHED afterwards
QUERYCLOSE: the child form is not permitted to close without the parent form's consent
CLOSE: the child form can close now

The parent form has to verify regularly the state of the field and act accordingly. The only way to do this is to use a NotesTimer (my favourite!).

Totally different and more difficult approach, albeit using the same technique but only possible in R6: use the universal-ID of a profile document that can be used to Lock and Unlock critical sections. The ID can be passed to the child form using the uidoc of the child, as above. The child form will then open the profile document created by the parent form, even data can be exchanged using the profile document.

There may be other ways to accomplish what you want, but what's the approach you prefer? Or do you have one of your own?
0
 

Author Comment

by:imjamesw
ID: 11996796
HI

Here is what I was thinking


If I grab the UNID of the parent and set it in the child

The child uses the UNID as a handle back to the parent

Scenario
Create a Parent Doc (Not Saved at this point)
Push button to open child
Push button on child to send mail and to set field on parent then close (Not Saved)


I can set the Parent UNID I see it on the form

I seem to be unable to write back to the parent


Set Parent = db.GetDocumentByUNID(doc.ParentUNID )
            Parent.CertSent = Now


THanx

James
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11996875
imjamesw,

> The child uses the UNID as a handle back to the parent
OK
 
> Push button on child to send mail and to set field on parent then close
Setting a field on the parent won't work, that's what I said above! The parent can set a field on the child document, not the other way round. By the way, if you don't save the parent document, it will not have a Universal-ID.
 
> I can set the Parent UNID I see it on the form
Nope
 
> I seem to be unable to write back to the parent
Correct
 

Sjef
0
 

Author Comment

by:imjamesw
ID: 11997537
HEy Sjef


What if we wrote the value I need to a Env variable and then after the child close refresh the field to look up the env if it is there
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11997747
Yes, you cold do that, but I ALWAYS try to avoid env. variables. If all else fails, then use them. But still, that value can only be set if the parent is saved.

I might have a better approach for you! What if you create the child document by means of a DialogBox, and let the parent update itself using the appropriate mechanism (RefreshParentNote)? You might wonder, but it is possible to save a document from a DialogBox!
0
 

Author Comment

by:imjamesw
ID: 11998626
Will the dialogbox send mail when the button is pushed

I do not thinkso as I do not think I can use form buttons within a dialogbox
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 2000 total points
ID: 11998649
Form buttons not, but Hotspot-buttons will work. Most important drawback: you don't have both the parent and the child open for update, since the DialogBox is modal.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12013637
Ah! Did you succeed this way? Using a DialogBox?
0
 

Author Comment

by:imjamesw
ID: 12019007
yes
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question