Using logic5 Min.

How to use the custom variable block

Use the custom variable block for more advanced use cases where you want to store a certain value (text, number, date or boolean) in a variable and use that throughout your form.


When to use

The custom variable block is an advanced action block that's primarily designed for no-code purposes. You can use it to store different types of values and use those values inside your form.

In combination with other blocks (like the calculator block and the set value block) and all logic features in Tripetto it enables you to do all kinds of no-code actions, for example:

  • Store a string value and use that in several places in your form;
  • Store a numeric value and increase the value of it when a certain answer is given;
  • Store a date value to check if that date is in the future in several places in your form;
  • Store a boolean value and determine the closing message based on the boolean value.

How to use

The custom variable block is available as a question type. Add a new block to your form and then select the question type Custom variable. You can add it in any given position and in an unlimited amount inside your forms.

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

Basic features

You can now change the features of the block to get the desired behavior:

  • Name

    The name of the variable in your form (not visible for respondents).

  • Type of variable

    This determines the type of data that you want to store in the variable. The following types are available:

    • A textual value;
    • A numeric value;
    • A date (and time) value;
    • A boolean value (true/false).
Screenshot of the form builder in Tripetto
Example of a custom variable to store a numeric value.

Additional features

Depending on the selected type of variable, additional features and settings can become activated to help you setup the variable. These features will popup on the left side of the pane. You can enable and configure these to your own needs.

Prefill feature

One feature that all variable types have in common is the Prefill feature. By enabling this feature, you can set the value that the variable should start with.


Show variables

You can show the value of the variable to your respondents, by using our piping logic. This works the same way as you can use 'normal' question blocks as piping values, by typing the @ sign at the desired position and select the custom variable (more information about piping logic).


Branch logic

You can also use the value of the variable as branch conditions, so the form can take decisions based on the variable. This works the same way as you can add logic based on 'normal' question blocks, using branch logic (more information about branch logic).

Screenshot of the form builder in Tripetto
Use a variable to execute logic.

Due to the flexibility of the custom variable block, the value of it can contain several types. It depends on the type of value that is saved inside the variable, which branch conditions you can create with it. Below you see the condition options per variable type.

Text conditions

  • Text matches your filter;
  • Text does not match your filter;
  • Text contains your filter;
  • Text does not contain your filter;
  • Text starts with your filter;
  • Text ends with your filter;
  • Text is empty;
  • Text is not empty.

Number conditions

  • Number is equal to your filter;
  • Number is not equal to your filter;
  • Number is lower thanyour filter;
  • Number is higher than your filter;
  • Number is between your filters;
  • Number is not between your filters;
  • Number is empty;
  • Number is not empty.

Date conditions

  • Date is equal to your filter;
  • Date is not equal to your filter;
  • Date is before your filter;
  • Date is after your filter;
  • Date is between your filters;
  • Date is not between your filters;
  • Date is empty;
  • Date is not empty.

Boolean conditions

  • Value is true;
  • Value is not false;
  • Value is equal to your filter;
  • Value is not equal to your filter;
  • Value is empty;
  • Value is not empty.

Filters

When we mention your filter above, there are some different filters that you can use to make the right comparison:

  • Fixed value - Compare with a fixed value that you enter;
  • Value - Compare with another block value entered in the form by a respondent (more info).

Calculations

You can use the calculator block to perform calculations with custom variables. Due to the flexibility of the custom variable block, the value of it can contain several types. It depends on the type of value that is saved inside the variable, which calculation operations are available in the calculator block.


Discover our form blocks

How to use the...
In this article

    Help us improve