XPages and Form Fomulas
One of the unique features in Notes and Domino are form formulas. On a view you can specify a formula that alters the form used to show a form. This is very handy to show the same document reformatted for different stake holders, so they can focus on what is important to them
Form formulas are a tried and tested solution. So I was wondering what happens when you bring XPages into the mix.In the propeller head properties of a form a developer can specify that an XPage should be opened instead of the form itself. One can specify an XPage for web access and/or client access. So I created and empty form and specified to use XPages instead.
It turns out that both the Notes client and the classic web views honor the form formula. So you have a new tool for upgrading existing applications and complex forms. If there is a subset a specific group needs to use you can XPage enable the form based on conditions in the document by providing a form formula and an empty form linked to an XPage. Unfortunately the form formula is ignored when you use a view control inside an XPage. Here you need to determine the Page to use in JavaScript. That's a little more complex but also way more flexible. To compute the page name on a per document basis you need to specify a row variable.
The variable is hidden in the All Properties panel. For every row of the view the variable will hold an instance of
What you can't do: open a classic form using this approach. But nothing stops you to add a column where you point to a document in a view in the form database.nsf/viewname/key_or_unid and then the form formula will work.
As usual: YMMV
Form formulas are a tried and tested solution. So I was wondering what happens when you bring XPages into the mix.In the propeller head properties of a form a developer can specify that an XPage should be opened instead of the form itself. One can specify an XPage for web access and/or client access. So I created and empty form and specified to use XPages instead.
It turns out that both the Notes client and the classic web views honor the form formula. So you have a new tool for upgrading existing applications and complex forms. If there is a subset a specific group needs to use you can XPage enable the form based on conditions in the document by providing a form formula and an empty form linked to an XPage. Unfortunately the form formula is ignored when you use a view control inside an XPage. Here you need to determine the Page to use in JavaScript. That's a little more complex but also way more flexible. To compute the page name on a per document basis you need to specify a row variable.
The variable is hidden in the All Properties panel. For every row of the view the variable will hold an instance of
NotesXspViewEntry
. You can either use .getColumnValue("columnname")
to get a specific column value or .getDocument()
to get to the NotesDocument object. You then can use your imagination what to compute. Change forms based on workflow status, authenticated user etc. A formula could look like this:
-
var curTaste = myRow. getColumnValue ( "Taste" ) ;
-
return (curTaste == "Sweet" ) ? "FruitWithSugarWarning.xsp" : "Fruit.xsp" ;
As usual: YMMV
Posted by Stephan H Wissel on 15 April 2010 | Comments (6) | categories: XPages