Need to dispay a document to the user on the web

I have a web application…

I need to know how to get access to a document on the web, I have a button on the web and I need to find a document in the view (with the user’s name, I have the user’s name at this point.) How could I have the document display to the user so that they can modify it if need be on the web…

Thanks

Alena…

Subject: need to dispay a document to the user on the web

There are also several other considerations. You need to ensure that the user can access the document (if you are using reader/author fields), and you certainly need to build into the form, methods for editing and saving the document from the web and make sure any validation formula have browser equivalents. Ditto for any form events, particulary the QuerySave/PostSave and QueryOpen/PostOpen events. The question here is, is this application already designed for the web and needs this one additional item, or is it a client application that is going to become a web application?

As far as finding the document via the user’s name, if this is unique (there will only be one), then there are several ways. Getting all documents in a view and cycling them until you find the one with the field with the correct value. This is only a good choice if the view is very, very small in terms of number of documents in the view. If you have a view where the first column is sorted by user name, then you can perform a getDocumentByKey with the user’s name and you will have that document (again, this assumes there is only one document). If there is more than one to be returned, you can get all of the documents from this view using getAllDocumentsByKey, and then parse the returned collection to narrow it down based on other criteria. At the end of the day, you need to:

  1. Determine which document you are looking for based on the information you know at the time you start looking.

  2. Get a handle to the document (using what you know about it and some LS or Java… or possibly even @dblookup/@dbcolumn).

  3. Obtain the document UNID

  4. Build a URL to the document with ?openDocument or ?editDocument

  5. Provide editing/saving methods on the document’s form if they are not already in place.

Subject: need to dispay a document to the user on the web

There are several ways of course.

You could just construct a URL to the document.

http://www.mydomain.com/folder/database.nsf/someview/mydoctitle?EditDocument

However, if the document isn’t there you’d get a 404 error.

The button could do a lookup to confirm the document exists first and then either open a default page or go to that doc using its uniqueID.

http://www.mydomain.com/folder/database.nsf/0/uniqueidentifier?EditDocument

Option 1 is faster but more dangerous.