Monday, March 27, 2006

Show-n-Tell Thursday

Originally posted on March 2, 2006

Last week, I showed a way to show responses in a view but open the parent of the response when a document was double-clicked. This week, I have another view tip. Form formulas allow you to open documents from a view using a form other than the one defined on the document. What I will show you is a way to provide users a choice of two forms to display documents and the means to set which form they want to use when they open the view.

Why would you use this? We have an application in which we want to display the fields from a document in a "report" format that can be printed for easier reading or in "data entry" format for user entry. This method allows us to use one view to perform both functions. In our case, the documents that appear in the view that uses this code are main documents and the "report" format form also contains LotusScript code to get field values from specific response documents to include in the report.

For simplicity, this assumes that all the documents in the view use the same form but it wouldn't be too hard to extend the code to handle more than one form. To give the users a way to determine the form they prefer, create an action button in the view with this code:

@If(@Prompt([YesNo];"Change Format";"You are currently opening these documents in the Summary Report format. Open documents with the document's form?")=1;
@If(@Prompt([YesNo];"Change Format";"You are currently opening these documents with the document's form. Open documents in Summary Report format?")=1;

The Form Formula for the view is then:


Nothing to it!

No comments: