I have documents that contain information on 4 different parties.
When displaying in a view, the first column is coded so that each document appears 4 times i.e. "Show multiple categories as separate documents."
The problem was, dependant on which row in the view was selected, the user wanted to display a different form e.g. If the 1st party was selected, they wanted to display a form showing only the 1st party details and so on...
A non-technical solution...
I could have used subforms or hide-whens etc but given that the 4 separate forms already existed and the large number of fields on each I used form formulas as follows.
- Use the view's QueryOpendocument event, which gives you a handle to a NotesUIView object. This object has the "caretcategory" property, which returns the value of the categorised column.
- Based on the value of "caretcategory" I was able to determine which form I needed to display and set an environment variable e.g. NotesSession.SetEnvironmentVar("DisplayForm" , "Form1")
- In the Form Formula for that view, retrieve the environment variable. e.g. @Environment("DisplayForm")
As the QueryOpenDocument even occurs first, the Form Formula can then work out which form to use.
Note: This also works in embedded views.
This was first published in May 2003