Variables simply placeholders for values - and are used everywhere to reference dynamic values from your database (backend), in the page (frontend) or from the project and the user environment. You can also create custom variables within the page and use actions to update variables based on events that happen while a user is interacting with your page. Below are some examples of how variables are used.
How to use Variables...
Display on Page
The most common use of variables is just to display them in the page by mapping their values into components, text, images etc. You can do this within almost any component. The variable manager will appear whenever a field accepts variables.
Filter Queries
You can use variables in filters to make them dynamic, either based on some properties of the logged in user, the page they are viewing - or within the page by changing the variables with actions.
Send in Forms
You can use variables to extend form functionality by creating new variables from existing ones and passing variables (rather than user inputs) in form submissions.
Condition / State
Apply conditions that reference variables using the logical conditions group. Now you can use actions to change the variables, which will alter the state and in turn, change the appearance or functions of components, dynamically adjust filters, etc.
Whenever possible, the variable manager will appear to allow you to insert dynamic values into the editor. You can also open the variable manager from the top controls.
Local Variables
In any page you can create and store custom variables, either in the page itself temporarily, or in a session or cookie so that you can use the variables in other pages during the user session or until the cookie expires.
Custom
You can create custom variables to store values in the page, as the result of actions. When creating a custom variable, you will need to define a type. A single value can be stored as text or numbers, or you can create an array to store multiple values. To modify arrays you should run a function, whereas single values can be set using the set a variable action.
Inputs
The values from input components can be accessed from the local data →
. They can be used to create custom forms, displayed directly in the page, referenced by conditions - or passed into queries as filters.
URL Parameters
You can pass values from the URL into the page and use them to display or reference in condtions.
Content Data
This group of variables lets you reference content (blocks, frames, components) relative to the current location.
Only visible when accessing variables from inside components and actions.
In this view we have opened the variable manager from an action, applied to a button. The values of these variables will be relative to the button itself and its parents (frame and block). In the case of previous and next - these will reference the neighboring elements.
You will see some variables colored purple above the main section. These are default variables that are mapped to specific fields in a data source. They should be used wherever possible, so that your dynamic values remain working even if the data source changes.
Card / Table / Component Records
When working inside the scope of a repeating group (Cards, Table) or a component connected to its own data source - you can access the fields from the data source.
Active Records
For each query, by default the first record will be designated as the active record and its field values can be referenced using the active record variable group. When an action is fired to change which record is active, all the active record variables will update automatically.
You can also access records adjacent to the active record (next / previous) or first / last of the array.
Rollups
You can access various types of roll-up (calculated) values from all the records in a given query / for a specific field. This is very useful for combining all the linked records in a field into a single array, or calculating the total value of the records in a shopping cart.
IDs - will provide a single array of all record ids in a query response.
Join - will combine all the arrays into a single array.
Sum - will calculate the total of all the records for any number field.
Count - will calculate the total number of unique occurrences of values.
Dynamic Pages
Each dynamic page in the path is connected to a record, which will be fetched when the page loads. All the field values for each dynamic page in the path will be available under a section of the variable manager, labelled with the record name.
You can access all dynamic pages in the path, not only the current page.
User and Account
Account Variables
In all pages you can reference the default values for the account and user groups the current user is logged into.
User Record
In portals, and pages in the same branch as a portal - you can access the entire user record and all fields stored in the user group’s data source.