How to use the calculator block
Perform realtime calculations inside your forms based on given answers. This article describes the basic usage of the calculator block.
When to use
The calculator block really pushes the smartness of your form to the next level. Calculator blocks can perform all kinds of calculations inside your form.
You can use calculations for many use cases, for example:
- Count the scores for a quiz;
- Calculate the prices of selected products for a quote;
- Apply discounts with coupon codes;
- Perform formulas for medical purposes (like a BMI calculator);
- Calculate the age of a respondent for age checks;
- Perform advanced formulas in a wizard.
These are just some examples. Basically you can calculate anything you want with the calculator block. Please have a look at our calculator features overview to see everything you can do with the calculator block.
How to use
The calculator block is available as a question type. Add a new block to your form and then select the question type
You can add unlimited calculator blocks in any position in your form, just how you need them. Inside each calculator block you can perform the needed calculations with all possibilities we sum up in the article below.
📌 Also see: Instant calculations inside question blocks
In the article you're reading now, we describe the possibilities of the full calculator block. But you don't always need to add a separate calculator block to your form for each calculation.
We made it easier to use the most common calculator features directly inside question blocks, for example to quickly score the options of a multiple choice question in a quiz.
We wrote a separate article about that: How to add instant scores and calculations inside question blocks.
To start with, you can give each calculator block a
Description. We advise to give it a good description, so you can easily see what that calculator does in your form.
Each calculation block starts with an empty list of
Operations. These operations are the core of the calculator and determine what this block will calculate. Each operation is a step in your calculation. You can add as many operations as you need.
To start with, you add the
Initial value to the list of operations by clicking the
button at the bottom of the Operations list. That's the starting point of your calculation. There are several options to determine the initial value:
Number- The most simple initial value is a static number that you enter yourself;
Block (given answer)- You can use given answers of your respondents as the initial value;
Score- You can instantly score selected answers of your respondents;
Comparison- A comparison can check a certain value and determine the initial value;
Function- There are several mathematical functions you can use to get an initial value;
Constant- There are several constants that you can use as an initial value, including dates and times;
Subcalculation- You can begin with a subcalculation. That adds a subcalculation (with full calculation features) to your initial calculation and the outcome will be used as the initial value.
Next, you supply the operations you want to perform after the initial value. For each operation click the
button at the bottom of the Operations list. You can add as many operations as you need to get to the right outcome. The following operations help you with that:
Add- Add up a value to the outcome of the previous operation;
Subtract- Subtract a value from the outcome of the previous operation;
Multiply- Multiply the outcome of the previous operation with a value;
Divide- Divide the outcome of the previous operation with a value;
Equal- Equal the calculator with a value.
Please have a look at this article for more in depth information about operations.
For each operational step there are lots of options to perform the right calculation. The following options help you to use the right values in your calculations:
Number- The most simple value is a number that you enter yourself;
Block (given answer)- You can use given answers of your respondents as the value;
Score- You can instantly score selected answers of your respondents;
Comparison- A comparison can check a certain value and perform an action based on the outcome;
Function- There are several mathematical functions you can use;
Constant- There are several constants that you can use, including dates and times;
Subcalculation- You can perform a subcalculation. That adds a subcalculation (with full calculation features) to your operations list that will be executed and the outcome will be used in the parent calculator.
These values make the calculator block a very powerful tool that you can use to calculate anything you need.
On top of the basic features and all operation options, the calculator block also has the following settings to help you with the outcome:
Formatfeature to determine how many decimal places the outcome of the calculator may contain.
Limitsfeature to enter a minimum and maximum value that the outcome of the calculator can become.
Prefixfeature to enter a label that's shown in front of the outcome of the calculator. Optionally you can specify a different prefix for plural values.
Suffixfeature to enter a label that's shown at the end of the outcome of the calculator. Optionally you can specify a different suffix for plural values.
Signsfeature to set what signs to use as decimal sign and thousands separator. Please note that in your forms these signs can be overwritten by the respondent's locale settings. In your dataset the selected signs always will be used.
By default this block will be executed in your form. Enable the
Statusfeature to disable the execution.
By default the name/title of this block will be used in your dataset. Enable the
Aliasfeature to use a different name in your dataset.
By default the collected data of this block will be stored to the dataset of each result. Enable the
Exportabilityfeature to take control over the storage. You can then include/exclude the data from your dataset. Please note that if you exclude data from the dataset you can never see and/or use the given answers from your respondents to this block, because the data is simply not stored at all.
Calculations in logic branches
Special features are built in for calculations inside logic branches. For example to perform calculations in repeating branches.
Please have a look at this article for more in depth information about using calculators inside logic branches.
The outcome of each calculator block is usable in different ways in the rest of your form. You can show it to your respondents, but also use it as the input for other blocks, or perform logic with it. And of course the outcomes are available in your dataset for results, notifications and webhook connections.
Please have a look at this article for more in depth information about using calculation outcomes.
Logic is important to make your forms smart and conversational. The outcome of the calculator block can work with the following branch conditions to help you with that:
- Calculation is equal to
- Calculation is not equal to
- Calculation is lower than
- Calculation is higher than
- Calculation is between
- Calculation is not between
- Calculation is valid;
- Calculation is not valid.
When we mention
your filter(s) above, there are some different filters that you can use to make the right comparison:
- Number - Compare with a fixed number that you enter;
- Value - Compare with another block value entered in the form by a respondent (more info).
The calculator block has lots of features, so we have several ways to learn all about it.
Our help articles help you out on all different aspects of the calculator:
- How to add instant scores and calculations inside question blocks;
- How to use the calculator block (current article);
- How to use operations in the calculator block (add, subtract, multiply, divide, equal);
- How to use given answers from respondents in your calculations;
- How to use scores in your calculations;
- How to use comparisons in your calculations;
- How to use functions and constants in your calculations;
- How to use subcalculations (multistep formulas) in your calculations;
- How to use text counters in your calculations;
- How to use calculations with logic branches;
- How to use the outcomes of calculator blocks.
We also made some overviews of the capabilities that the calculator block provides: