Interactive forms in ContactsLaw can utilise formulas in order to meet complex requirements. These are the same type of formulas used in document templates and description expressions.
Formulas in rules
In most places where a rule on the form calls for a particular value (e.g. in a condition or action), you can specify a formula to provide that value. The syntax is the same as that used in ContactsLaw.
However, formulas on interactive forms cannot refer to records or controls directly by their name (as set using the form designer). To include these in your formula, you must first assign them to variables:
When selecting 'Formula' in the rule value editor, an additional grid will appear to the right. For each variable you want to refer to within your formula, choose a name (single letters are preferable but not mandatory) and specify where the value comes from. (Note that, because values are nested, the value for a variable in a formula may itself be a formula) You can then write your formula, expressed in terms of these variables. For especially long formulas, you can expand the height of the text field.
The above example selects either the file manager or supervisor, depending on whether the executor's date of birth is prior to a certain cut-off date.
Dynamic evaluation
Normally, rule values which come from formulas are read-only; that is to say, they can be examined by a rule but not changed by it. You can, however, construct a formula whose result is the name of a control or record on the form. By using the 'dynamic evaluation' option, the rule will take the value from that control/record instead of simply using its name. This enables you to use a formula in places where the value is changed (e.g. in a 'set value' action).
In practical terms, this is used when you have several related records and the record you wish to alter is derived from another record.
See also
Interactive Forms Framework
Simple Formulas