What are variables and meta variables?
Variables are labels for any data items captured from end-users that can be referenced to be displayed or manipulated later in the App.
What if I want to reference information about the user, App or Project Team?
Meta variables are a type of variable which are in-built into Checkbox which can be used to display current user names and emails, App names, generate transcript links etc. See the list of all meta variables.
How are variables used?
Variables can be referenced to be displayed throughout your App including inside your emails and automatically generated documents using double curly brackets (e.g. {{TXT2}}). This is especially useful when tailoring your App based on the end user’s responses.
For example, if Jane Smith filled in a name field with the variable “TXT4” that was referenced later in the App (i.e. {{TXT4}}), it will display “Jane Smith”.
Variables are also used to create conditions for dynamic smart forms, weighted assessments and triage tools. Learn more about conditions here.
List of Default Variables
The default variable names that you can use are:
Field type | Field code | Example |
Paragraph | PARA# | PARA5 |
Text input | TXT# | TXT5 |
Number input | NUM# | NUM5 |
List | LIST# | LIST5 |
Radio | RAD# | RAD5 |
Dropdown | SEL# | SEL5 |
Yes/No | ACT# | ACT5 |
Table cell | TBL#_[cell] | TBL5_A3 |
List Size (Number of values in a list) | LIST#_SIZE | LIST3_SIZE |
Loop | LP#_SET# | LP5_SET1 |
Checkbox | CBX# | CBX5 |
File Uploaded by user | FILE# | FILE4 |
Can you rename variables?
Yes. For best practices, variables should be renamed for easier and convenient referencing. For example, the variable for the name input field “TXT4” can be renamed to “Name” and be referenced accordingly (i.e. {{Name}}).
Default variable names as shown in the table above are not recommended to be used as it can create confusion if similar default variables are used. For example, variables for the name and email input can be “TXT4” and “TXT6” which is difficult to differentiate when trying to reference a correct variable.
Notes:
- Any existing conditions referencing the original variable name will now be invalid and need to be manually changed to the new name (e.g. once “TXT4” is changed to “Name”, “TXT4” will now be invalid)
- Variable names are case sensitive
Follow the instructions below to rename variables.
What are some tips and tricks when renaming variables?
It is typically encouraged to rename variables using camel cases or underscores to separate different words in a variable name for consistency. For example, for TXT129 (system generated) that captures the end user first name should be written in either camel cases (i.e. firstName) or underscores to separate each word (i.e. first_name).
Another useful tip is to use the system-generated letters in lowercase for the prefix of the variable name. This makes it easy to search by variable type when you are referencing this variable later on, and also to remember the variable type when you are building your App.
- Text field becomes txtVariableName
- Radio becomes rdoVariableName
- Dropdown becomes selVariableName
How to rename variables
- In your App Studio, click “Show Logic” in the toolbar and observe the variable names that appear (e.g. TXT4 in the first FORM block
- Click onto a FORM block and click “OPEN FORM BUILDER”
- Click into the text input field with the variable name TXT4
- In the Property Editor, rename the variable name to “Name”
- Go back to the Studio and turn “Show Logic” off and on again from the toolbar to refresh the names. Observe that the variable name has successfully processed, in this case from “TXT4”
to “Name”.
Limitations to renaming variables
- Only letters of the alphabet, numbers, _ (underscore) can be used
- There is a 20 character limit
- Uppercase and lowercase versions of the same character are distinguished
- The variable name field cannot be empty
- The variable name needs to begin with an alphabetical character
Related Articles