@Command([OpenDocument]) view action on the web

I’m trying to create a view action which opens a selected document for editing. The killing aspect of this is that it’s supposed to work on the web. I’m sure I’m missing something basic, but I can’t for the life of me figure out how to make it work. The Help says that you can open documents on the web using @Command([OpenDocument]) in conjunction @Command([OpenView]). It doesn’t, however, describe how to use them. How, if at all, can I get this to work?

Subject: @Command([OpenDocument]) view action on the web

Saw this in the help:

This formula opens the document, “Savage Mountain,” in the By Title view of a Web application.

@Command([OpenView];“By Title”;“Savage Mountain”);
@Command([OpenDocument])

http://ww.benpoole.com

Subject: @Command([OpenDocument]) view action on the web

Hit F1 in Designer and you will get all the information you are looking for.

To open the document in Edit mode, specify as “1” the writeOrReadOnly parameter to OpenDocument. For example:

@Command([OpenView]; “Main View”; “one”);

@Command([OpenDocument]; “1”)

For Web applications, you cannot use the UNID and width:height parameters to OpenDocument.

The OpenDocument command, used in conjunction with FileOpenDatabase, opens an existing document in another database. This example opens the first document in the “All Documents” view in “document examples.nsf”:

@Command([FileOpenDatabase];

“” : “document examples.nsf”; “All Documents”; “$first”);

@Command([OpenDocument])

These @commands are equivalent to URL commands formatted as follows:

http://host/database/view/key?OpenDocument

http://host/database/view/key?EditDocument

Subject: RE: @Command([OpenDocument]) view action on the web

I’ve already read that, and it doesn’t tell me how to do what I need. I need to reproduce the function of a @Command([EditDocument]) action, where the user can select a document, click a button, and open that arbitrarily chosen document for editing, but do it on the web. The examples, so far as I can see, only provide hard-coded values, not values that are drawn from variables or otherwise dependent on some kind of user interaction. I need to open a selected document, not the first or last and not one that can be identified by a key in the view (the contents of the first sorted column do not uniquely identify documents).

Subject: RE: @Command([OpenDocument]) view action on the web

Your problem is not with the OpenDocument command – it’s with identifying which document is selected. Web applications have two ways to display views – as HTML and with an applet. With HTML there is no way to select a document unless you enable the option to display selection checkboxes in the HTML.

Whether HTML or applet, JavaScript code can identify which document(s) are selected and open the document using location.href = (some URL you calculate) – or window.open or however you wanted to do it. However, finding out which documents are selected is different in the two cases.

Let me ask you, though – you know that you can open the document in an HTML view by clicking its link, or in the applet view by double-clicking the document. You do realize that you can just set the form to always open in edit mode? Or that you can put an Edit action on the form to let them change the mode?

Another option if you are using HTML is to create a column that uses passthru HTML (in square brackets) to provide an “edit link” in addition to or instead of the “read link” that the view provides by default. The HTML would be calculated using the @DocumentUniqueID and @WebDBName. This lets you give the user a choice, and also provides a one-click solution, and also bypasses the issue of what does your control do if the user selected multiple documents.

Subject: RE: @Command([OpenDocument]) view action on the web

You do realize…

Yes, I do. I’ve got users demanding that the Notes functionality (select document, click button) be exactly reproduced in the web client. I’ve got a work-around in place, but they’re not happy with it, which is what has brought me to ask the question here. The question isn’t how to get a document open for editing; it’s how to do it by selecting a document in a view and pressing a button. It’s sounding like, contrary to what the documentation might suggest, the @Command won’t do what I need it to and I’ll need to go with a JavaScript solution.