Video tutorial about calculations.
Using logic6 Min.2 Min.

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.

Screenshot of a quiz in Tripetto
Demonstration of calculating a quiz score.

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 Calculator.

Screenshot of the form builder in Tripetto
The calculator block is available from the Question type menu.

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:

Description

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.

Operations

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.

Initial value

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.
Screenshot of the form builder in Tripetto
In this example we start with a fixed number 10 as the initial value.

Operations

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.
Screenshot of the form builder in Tripetto
In this example we add up the score of the given answers. A correct answer adds value 1, an incorrect answer adds value 0 to the calculator.

Operation properties

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.

Please have a look at these articles for more information about using blocks, scores, comparisons, functions/constants and subcalculations inside calculators.

Screenshot of the form builder in Tripetto
In this example we calculate the price ($9.99/piece) based on the amount that the respondent has entered and subtract a 10% discount.

Settings

On top of the basic features and all operation options, the calculator block also has the following settings to help you with the outcome:

  • Format
    Enable the Format feature to determine how many decimal places the outcome of the calculator may contain.
  • Limits
    Enable the Limits feature to enter a minimum and maximum value that the outcome of the calculator can become.
  • Prefix
    Enable the Prefix feature 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.
  • Suffix
    Enable the Suffix feature 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.
  • Signs
    Enable the Signs feature 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.
Screenshot of the form builder in Tripetto
Additional features of the calculator block.

Options

  • Status
    By default this block will be executed in your form. Enable the Status feature to disable the execution.
  • Alias
    By default the name/title of this block will be used in your dataset. Enable the Alias feature to use a different name in your dataset.
  • Exportability
    By default the collected data of this block will be stored to the dataset of each result. Enable the Exportability feature 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.


Outcomes

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.


Logic

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:

Block conditions

  • Calculation is equal to your filter;
  • Calculation is not equal to your filter;
  • Calculation is lower thanyour filter;
  • Calculation is higher than your filter;
  • Calculation is between your filters;
  • Calculation is not between your filters;
  • Calculation is valid;
  • Calculation is not valid.

Filters

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).

More information

The calculator block has lots of features, so we have several ways to learn all about it.

Help center

Our help articles help you out on all different aspects of the calculator:

Overviews

We also made some overviews of the capabilities that the calculator block provides:


Discover our form blocks

How to use the...
In this article

    Help us improve