Improvements to variables in formulas

An important feature of Orbeon Forms are formulas. They allow you, as if the case in spreadsheets, to perform calculations of values and much more.

Some formulas can refer to the current value of form controls using a variable notation, with a dollar sign followed by the name of the control. So if you have a form control called price, you can refer to its value in a formula with $price.

However, until Orbeon Forms 2021.1 included, this variable notation didn’t work everywhere. You could use it for:

  • Validation Constraints
  • Visibility, Read-Only, Initial Values, and Calculated Values

The good news is that Orbeon Forms 2022.1 will feature enhanced support for variables in formulas. Specifically, variables will be supported in the following places:

  • Repeated Sections and Grids
    • Minimum Number of Repetitions
    • Maximum Number of Repetitions
    • Freeze Repetitions
  • Control Settings Templates
    • Label
    • Hint
    • Help Message
    • Explanatory Text
  • Number
    • Prefix
    • Suffix
  • Service Response
    • Source of control value
    • Source of choices, including label, value, and hint
  • Dynamic Dropdown and Dynamic Dropdown with Search
    • Resource URL

For example, assuming controls named state and city, a zip Dynamic Dropdown Resource URL might be expressed as:

/service/zips?state-abbreviation={$state}&city={$city}

This, in fact, was a top request for enhancement from Orbeon Forms users!

Variables in the Resource URL
Variables in the Resource URL

Note that, as with other uses of variables, if you rename a form control, dependent formulas are automatically updated as well. For example rename state to us-state and the expression is automatically updated to:

/service/zips?state-abbreviation={$us-state}&city={$city}

We hope you will enjoy this improvement to Orbeon Forms in Orbeon Forms 2022.1!