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.
- 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.
You can now change the features of the block to get the desired behavior:
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 (
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.
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.
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).
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).
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 matches
- Text does not match
- Text contains
- Text does not contain
- Text starts with
- Text ends with
- Text is empty;
- Text is not empty.
- Number is equal to
- Number is not equal to
- Number is lower than
- Number is higher than
- Number is between
- Number is not between
- Number is empty;
- Number is not empty.
- Date is equal to
- Date is not equal to
- Date is before
- Date is after
- Date is between
- Date is not between
- Date is empty;
- Date is not empty.
- Value is true;
- Value is not false;
- Value is equal to
- Value is not equal to
- Value is empty;
- Value is not empty.
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).