Using variables in workflows
Last updated
Was this helpful?
Last updated
Was this helpful?
In order to start using variables, click on the three dots in the upper-right corner and find 'Variables'.
Order: The order of the variables is relevant when setting them as parameters, as they will be used as inputs for the generated stored procedure in that order, defining the procedure's signature.
Name: Give a name to the variable. This name will be referenced as @name within an expression.
Type: Number and String variables are supported.
Default value: The default value for the variable. When executing a workflow from the UI, this is the value that will be given to the variable.
Parameter: Mark a variable as parameter if you need to allow external access to it. This is helpful when running a workflow via API call.
For Databricks connections, executing Workflows via API is currently a work in progress. For this reason, the use of parameters is not supported on this type of execution. The functionality will be available soon, please get in touch with support@carto.com if you have feedback about this missing functionality.
Learn more about executing parameterized workflows in this section.
Click on the '+' button to confirm the creation of the variable. A new entry will appear where you can keep adding variables.
Once a variable has been defined, you can use them to control the value of a component's settings. As global variables, they can be used in one or many occasions within the same workflow, and they will apply the same value to the setting where they're used.
To use a variable in a setting, just start typing {{@variable_name}}
and the available matching variables will appear. Make sure that you close the variable name with double curly braces, as shown in the screenshot below
Not only variables, but expressions are also allowed, so something like this could be used as a setting on a node: {{@buffer_radius / distance * 10}}
which combines a parameter with a column value in a mathematical operation.