How to calculate a price right in the form

← Back

Add a field of type “Calculator” and enter the “Calculation formula” — in it you can reference other fields in curly braces.

  1. Add a field and select the “Calculator” type.
  2. In the “Calculation formula” field, write an expression. Names of other fields are inserted via buttons from the “Insert field:” row — they're substituted in curly braces: {Print run} * {Price}.
  3. Save. The result recalculates as soon as the visitor changes any field in the formula.

What the formula language can do:

  • arithmetic + - * / ( ), decimals written with a comma or dot;
  • conditions: If … then … ElseIf … then … Else … EndIf;
  • comparisons = <> < > <= >= and CONTAINS, logic AND, OR, NOT;
  • functions (arguments separated by semicolons): ROUND(x; digits), ROUNDUP, ROUNDDOWN, INT, MIN, MAX, ABS, SQRT, POWER(x; y), COUNT;
  • multiple choice: {Options} CONTAINS "Lamination" and COUNT({Options});
  • comment — two slashes to the end of the line.

The full language reference is in the field window itself, below the formula — “Formula language reference”.

If it didn't work

  • The result is empty. Most likely the formula contains a field the visitor hasn't filled in yet. Set a “Default value” for such fields.
  • The field name in the formula doesn't work. Insert it with the button, not manually: the name must match the field name letter for letter.
  • You renamed a field — the formula broke. Fix the formula: it references the name.
Did the article help?

See also