Calculation using Code

Calculation formulas follow a similar pattern like the calculation editor, but here you can use a mathematical formula with placeholders for customer input and specific keywords to include many settings from questions and answers in the formula.

After adding a new calculation, select the type ‘Code to toggle. You can add up to 4 placeholders that will be used in the formula with the letters A to D. The placeholders get replaced with the value entered by the customer for that question (or zero if no input is there).

Important note: Always pad a placeholder with a space (before and after), so that the formula can be parsed properly.

Example formulas:

( A * B ) + C

ElementAttribute(95.selectedOption.assignment_custom_1, 0)

Keywords

You can use keywords to use values other than user input for your formula (e.g. Total for the price total of the current product). A list of keywords is found in the on-screen notes at the formula editor.

With the keyword ElementAttribute you can use metadata of a question and its assigned answers. E.g. use ElementAttribute(10.selectionPrice) to get the current price for the question with ID 10. You can look up question IDs at the question list screen or at the placeholder drop-downs.

You can also enter PHP code to make more complex calculations here.