“If confusion is the first step to knowledge, I must be a genius.”
Help please with this problem. I have searched the forum, read Help, etc.
I need to open a document from within another document. Here is the scenario:
Form One is created and saved.
Form Two is created, inherits values from Form One, and is saved.
I need the ability to open Form Two from a button on Form One.
An important field is the CS# on Form One and TR# on Form Two.
If the CS# is CS00395 the TR# will be TR00395.
What would be the best (easiest, since I am already confused) way to do this.
Thanks for all responses,
Tammy
Subject: Open a document from within another document.
Hello,
You can use @Command([Compose];“Form2”) in a button.
And it works on the web too.
To inherit values from Form1, create two computed fields on Form2, put the name of your two fields (CS and TR) of Form1 as their formula.
Hope it helps,
Philippe
Subject: RE: Open a document from within another document.
Philippe,
Thank you for responding. I guess I did not make my self clear in the first post. I do not want to create a new document. I want to open an existing document from within another document. Any other suggestions?
Subject: RE: Open a document from within another document.
you can use lotusscript and the getdocumentbykey(key) method of notesview to get the document you want based on a key value taken from the document. this key would be a field on the document you have open or a computed value of some sort. it just needs to equate to the value found in the first column of a view containing the documents you want to select from. you can find more about this method in the help and on this forum. also look into the notesuidocument for accessing and displaying the document.
Subject: RE: Open a document from within another document.
Thank you Joel for your response.
I have read about getdocumentbykey. First dumb question…when the document is found will it open it? Do you have any code you would be willing to share?
Subject: RE: Open a document from within another document.
Tammy,
No, it won’t. But assuming (a) the CS# is stored in a field called CSNumber and (b) you have a view where the first sorted column contains the TR#, the last line of this code will:
dim w as new notesuiworkspace
dim s as new notessession
dim v as notesview
dim csdoc as notesdocument
dim trdoc as notesdocument
dim trnumber as string
set csdoc = w.currentdocument.document
trnumber = “TR” & mid(csdoc.CSNumber(0), 3)
set v = s.currentdatabase.getview(“ViewSortedByTRNumber”)
set trdoc = v.getdocumentbykey(trnumber)
if trdoc is nothing then
msgbox “No document with TR# " & trnumber & " exists.”
else
w.editdocument false, trdoc
end if
Subject: RE: Open a document from within another document.
BEAUTIFUL! Thanks Bruce, nice of you to help out (poor) Tammy. I’ll let you know how I make out with the code.
Subject: But you’re not Poor Tammy any more
now that you’re beyond R4.x.
Subject: RE: But you’re not Poor Tammy any more
Awesome Bruce! It worked perfectly. I love LotusScript. (?) Thanks a million. (just) Tammy
Subject: U want it on Web or Client ???
Subject: RE: U want it on Web or Client ???
Hello LoNo Developer,
Client please, thank you for helping.
Tammy
Subject: RE: U want it on Web or Client ???
As you said that Form Two inherits values from Form One.Create a field on the Form One called “DocUNID” which should be “Text” and “Computed When Composed”.
On Form Two, create a similar field which the formula as “DocUNID”. So when Form Two is composed from Form One, this field will be stamped with the Document Unique Id of Form One.
Create a New View with selection formula being
Select Form=“Form Two”.
1st column should be sorted and categorized with the column formula being “DocUNID”.
Now in Form One, create an embedded view and select Single Category. In the Single Category formula you could specify “DocUNID”
For more help on Embedded View look here :
http://www-12.lotus.com/ldd/doc/domino_notes/Rnext/help6_designer.nsf/855dc7fcfd5fec9a85256b870069c0ab/cf07de2aede754a485256c54004b795e?OpenDocument
hope this helps!!
Ashish