Global Variables
A global value set at a workflow level
Last updated
A global value set at a workflow level
Last updated
Global Variables are powerful tools used to dynamically customize a workflow's results. Global Variables can be strings, numbers, dates, boolean values and more. They can also be based off of variables in tables/columns in your workflow.
Every workflow has access to the following global variables:
RUN_DATETIME
A timestamp (in ISO 8601 format) of when the workflow started running.
SESSION_ID
A unique auto-generated ID representing the session that caused the workflow to run.
WORKFLOW_ID
A unique auto-generated ID representing the workflow being run.
WORKFLOW_NAME
The name of the workflow being run.
CURRENT_USER
The email address of the user running the workflow.
If the workflow is executed by a Data App user, the value "Data App User"
will be used instead.
If the workflow execution is headless (eg. on a schedule), the value will be an empty string ("")
.
WORKSPACE_ID
A unique auto-generated ID representing the workspace that the workflow is contained in.
WORKSPACE_NAME
The name of the workspace that the workflow is contained in.
To create your own global variable simply click on the plus circle in the top right corner of your canvas and fill out the form. Once the variable is created, apply it to your workflow by including it in a formula in either the Filter or Edit Columns tools. Global Variables will show up in the expression builder with the format {var!ExampleVariable}
.
If a global variable is used in a tool in the Canvas tab, it can also be applied in your Data App. When crafting a story in your Data App, you can use global variables to provide different views of your data.
There are two ways in which Global Variables can be used in a Cascade workflow: in the Expression Builder and through Templating.
Global Variables can be used in the expression builder to create dynamic formulas. Simply start to type your Global Variable name into your formula and it will show up as a selectable option with the {x}
icon.
The expression builder can be found in the Filter, Edit Columns and Validate tools and will always be represented with the {var!ExampleVariable}
format.
Global Variables can also be used in your workflow outside of the Expression Builder. This is through Cascade's Templating tool. There are many different ways to use templating throughout Cascade workflows, so we'll walk through each one here.
Templating can be used to create Dynamic URLs in the following import tools:
Importing via SQL commands
Simply replace the section of your URL you would like to be dynamic with your variable in the templating format. For example, if I wanted to import Baseball data that all had the same URLs with the exception of the name of the file (i.e. Batting, Pitching, etc), I could take this URL:
https://.../cascade/datasets/Baseball/
Batting
and convert it to:
https://.../cascade/datasets/Baseball/
{{Baseball_filename}}
This new URL variable would allow me to dynamically change the file I wanted to import based on my global variable value.
Other tools within Cascade Workflows also allow you use Templating while working with your data.
Chart
For each of these workflows Global Variables can be used in any of the available text boxes. Use Templating to dynamically replace values, name or describe validations, or even label chart axes.
Templating can also be used in multiple parts of Dynamic Workflows. Use Global Variables in 'Add Dynamic Input' or 'Add Dynamic Output' to dynamically name or describe both inputs and outputs in the workflow canvas.
Then, when linking to your Dynamic Workflow in other workflows (see above example with "Crypto Avgs"), your original global variable will become an input to your new reference tool.