Wednesday, 14 January 2009

Good old @functions

From time to time we use Notes databases to store documentation for processes and projects. And to avoid that everybody enters information using their own format we ask peolpe to use predefined templates to create unity in the created documentation. Normally these templates would be provided as main documents in the database and the users will copy and paste these template documents.
Now I remembered from way back in Notes 3.3 that I had created a bit of @function code to allow users to pick a template from a list and copy the selected template into the document the user is working on.

This is how the @function code works:
  • Let the user pick a template from a list of templates using @Picklist and and categorised view
  • Open the selected template document
  • Navigate to he body field
  • Select all the content in this field
  • Copy the selected content to the clipboard
  • Close the selected template document (and view)
  • Paste the selected content at the location of the cursor
Downside of this method is the screen seems to flicker as the function opens a view, a document, selects the body, closes the document, closes the view and pastes the content, but with the current workstation speeds it is hardly noticable.
How about that in the age of xpages, sidebar widgets and composite applications.

For those interested I have made a database available for download. The function is available on the main topic, place the cursor in the body field and click on the "import template" button.

Note: the download is stored on Dennis' blog, as I cannot find an option in Blogger to provide downloads of type zip.

No comments: