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.
Name
You can give your custom variable block a Name
so you can recognize it in your form's structure and dataset. This name is not visible for your respondents.
Type of variable
The Type of variable
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
).
Settings
Depending on the selected type of variable, additional 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.
Options
Depending on the selected type of variable, additional options 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.
In general the following options are available:
- Prefill
Enable thePrefill
feature to set a fixed initial value of this block. - Alias
By default the name/title of this block will be used in your dataset. Enable theAlias
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 theExportability
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.
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.
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.
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 than
your 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.