Handbook

Create variables and constants

By the end, your configurator has a named intermediate result that several rules can read.

What you need

A variable is a named rule: it works out a value once and every rule reads it by name. When the calculation changes, you fix it in one place. A constant is a variable whose rule is a fixed value, such as a wall thickness of 40. Both live in one list.

Steps

  1. Open the Variables and constants step.

    It sits between Define inputs and Rules. You see a list with the columns Name and Value.

  2. Click New variable.

    The button is on the ribbon. While there are no variables, the row Add a new variable does the same. The new variable is selected at once, and the Properties panel shows its Name and Rule.

  3. Fill in Name.

    Type Vnitřní délka and press Enter.

  4. Write the Rule.

    In the editor, type [Délka] - 2 * 40. It writes itself as soon as you stop typing. The Value column shows 3520, the result at the inputs' default values.

  5. Read the variable in a rule.

    In the Rules step, insert it from the Variables menu or type its name: [Vnitřní délka] / 2 gives 1760. A form field rule reads it the same way.

  6. Create a constant (optional).

    Add another variable named Tloušťka stěny with the rule 40. You can then write the formula as [Délka] - 2 * [Tloušťka stěny] and change the thickness in one place.

  7. Extract a variable straight from a rule (optional).

    In a rule's editor, select part of the formula and press Ctrl+E, or right-click and choose Extract variable. Type the Variable name and click Create variable. The selection becomes a reference.

  8. Save the configurator.

    Click the save icon in the window header or press Ctrl+S.

Check that it worked

The Value column shows 3520 for Vnitřní délka. In the Define inputs step, change the default of Délka to 4000: the variable's value is 3920. Then put 3600 back.

Common problems

What's next

Back to the handbook