Solved

Button to open existing document, not compose

Posted on 2008-11-02
7
1,303 Views
Last Modified: 2013-12-18
I have documents with a field "Title".  The contents of this field in all of the documents match the contents of a Title field in a different form.

Specifically, there is a single 'Directions" document that relates to the larger collection of "Report" documents.

I need a button in the "Report" documents that will take the user back to the "Directions" document.

I have

@Command([OpenView]; "Directions"; Title);
@Command([OpenDocument])

where the Directions view lists all of the Directions documents with the title name in the first column.  It works, but it leaves the Directions view open and I don't want that.  It also seems to take a long time to complete the process.

1.  If I go with the @commands, how do I close the view?
2. An alternative would be, I have lotusscript that creates the Report documents - what can I add that might add a doclink back to the directions form?

thanks experts you rock!
0
Comment
Question by:jkee54
7 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 22864762
0
 
LVL 7

Expert Comment

by:olaraak
ID: 22865106
The simplest way to add document link back to directions document, is to add a rich text field to Direction document, named for example "ParentLink", and in form properties box, on second tab, select "Inherit entire selected document into rich text field", pick your field's name and leave type "Link".

There are other ways to accomplish this, using Lotusscript, but this is the easiest one.

When creating a new Direction document, Directions (parent) document must be selected, to show Notes which document you want to link to.
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 22867054
>> "If I go with the @commands, how do I close the view?"

I would try loading the view and document into the same frame.  That way you don't need to close the view, the document simply replaces the view in the frame.  To do this, you need to use @SetTargetFrame along with the @Commands that can support it.  [OpenView] supports @SetTargetFrame but [OpenDocument] does not. However, since you are not using any of the optional parameters for [OpenDocument], you can easily switch to [EditDocument] which does support @SetTargetFrame.  For example, if you have a frame named "NotesView" (which is highly recommended by the way), you could try this:

@SetTargetFrame("NotesView");
@Command([OpenView]; "Directions"; Title);
@SetTargetFrame("NotesView");
@Command([EditDocument]; "0")
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22871269
Assuming you have a current document doc, with a field Title:

Dim ws As New NotesUIWorkspace
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim vdoc As NotesDocument
Dim view As NotesView

Set db= ns.CurrentDatabase
Set view= db.GetView("Directions")
Set vdoc= view.GetDocumentByKey(doc.Title, True)
Call ws.EditDocument(false, vdoc)

0
 

Author Comment

by:jkee54
ID: 22892605
sjef,

Gives error, 'variant does not contain an object'
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 250 total points
ID: 22893070
As I said, the code assumes you have a current document in the variable doc. If that's not the case:

Dim ws As New NotesUIWorkspace
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim vdoc As NotesDocument
Dim curdoc As NotesDocument
Dim view As NotesView

Set curdoc= ws.CurrentDocument.Document
Set db= ns.CurrentDatabase
Set view= db.GetView("Directions")
Set vdoc= view.GetDocumentByKey(curdoc.Title, True)
Call ws.EditDocument(false, vdoc)
0
 

Author Comment

by:jkee54
ID: 22898017
Excellent!  Thank you for the extra direction, works perfectly.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.

861 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