Variables are key when setting up dynamic applications. Instead of entering set values everywhere, you want to use variables.

Variables explained

Variables can be seen as placeholders for temporary values, used in the calculation of a certain value (functions and/or formulas). Although this may sound difficult at first, let's take a look at a famous example: Pythagorean theorem.

"The sum of the areas of the two squares on the legs (a and b) equals the area of the square on the hypotenuse (c)."

I think I'm safe to say everyone had this at some point in school. No, this doesn't mean you have to be a superstar at math to use Betty Blocks. But it does explain the variable principle. a2 + b2 = c2 doesn't give us results back until we replace a and b with actual values. This means a and b are variables used for calculating the value of variable c

What kind of values are used in the variables a and b totally depends on how we're building our flow. Are we using a set value? Are we calculating a value? Are we feeding a value from a previous action? If this is still a bit vague, don't worry. Later on we'll provide some examples per type.

Variable browser

No matter where you are applying variables, if you want to use them, the Variable browser is your best bet. Instead of typing the variables name in the selection field, click the blue Insert variable or chainlink button to open the Variable browser.
In it, you'll find all available variables to use in the section you're currently viewing.
This also prevents any typo's and ensures the variable is properly connected.

Prefix

Whenever a variable is used, it can be recognized by its prefix: var:.
Whether it's assigned to a property in an event, selected in a different variable or chosen in a filter, it always starts with var:. There is one exception and that's when used in templates, combined with our Templating Language. For example, parsing the text variable var:company_name is done with {{company_name}} in your template.

Types

When implementing variables in your application, it's important to keep the use case in mind. Depending on the situation, we may need to choose the variable ourselves, or the variable needs to be automatically generated/determined. We can divide this in 2 main typegroups; Variables and Input variables

Variables

Variables that already contain a set value or automatically calculate a value based on an expression. Do not require input by the user, page/endpoint or previous action.
Defined in:

  • Action
  • Action event
  • Page
  • Property
  • Template
  • Global variable

Input variables

Variables that don't contain a value yet and don't contain an expression to calculate a value. Requires input by user, page/endpoint or previous action. Can be assigned a value when using the parent action as sub-action or when action is initiated manually from backoffice.
Defined in:

  • Action
  • Page
  • Webservice
Did this answer your question?