What You'll Learn
Create dashboard variables for dynamic filtering
Build site and machine dropdown selectors
Chain variables so machine options depend on selected site
Use variables in Infinity queries
Create hidden helper variables
Completed Tutorial 4.1 and 4.2
Understanding of Infinity queries and JSONata
Dashboard variables create interactive dropdowns that let users filter data without editing queries. They're essential for:
Site selection – Choose which location to view
Machine selection – Filter to specific machines
Time period selection – Custom date ranges
Multi-user dashboards – One dashboard serves many needs
Site, machine, product dropdowns
Shift names, status options
Creating Your First Variable
Let's create a site dropdown that queries the ENLYZE API.
Step 1: Open Variable Settings
Click the gear icon (Dashboard settings)
Select Variables from the left menu
[SCREENSHOT: Dashboard settings with Variables menu]
(leave empty - show variable)
Important: Variable names should be lowercase with no spaces. Use underscores if needed (e.g., machine_uuid).
[SCREENSHOT: Variable basic settings]
Under Query Options:
Set Data source to Infinity
Set Query type to Infinity
The query editor appears. Configure it like a panel query:
[SCREENSHOT: Variable query configuration]
Scroll down to Value options:
The dropdown needs to know which fields to display and store:
Display value: What users see (site name)
Stored value: What's used in queries (site UUID)
For Infinity variables, the first column becomes the display value, and if there's a second column, it becomes the stored value.
To control this, add columns to your query:
Scroll to Columns in the query
[SCREENSHOT: Column configuration for variable]
Step 5: Preview and Save
Click Run query to preview values
Verify the dropdown shows site names
You should see the site dropdown at the top of your dashboard.
[SCREENSHOT: Site dropdown in dashboard]
Using Variables in Queries
Now use the ${site} variable in panel queries.
Filtering Machines by Site
Create a panel that shows machines for the selected site:
URL:
Root selector (JSONata filter):
This filters the machines array to only include those where the site matches the selected variable.
[SCREENSHOT: Panel showing filtered machines]
Variable Syntax
Chained Variables
Create a machine dropdown that updates when the site changes.
Step 1: Create Machine Variable
Add a new variable:
Use JSONata to filter machines by the selected site:
$filter($.data, function($v){ $v.site = "${site}" })
Add columns:
Critical: Set refresh behaviour so machine options update when site changes:
[SCREENSHOT: Chained variable configuration]
Step 4: Test the Chain
Verify machine dropdown updates to show only machines at that site
Multi-Select Variables
Allow users to select multiple values.
Enabling Multi-Select
In variable settings:
[SCREENSHOT: Multi-select settings]
Using Multi-Select in Queries
Multi-select variables return multiple values. Handle them appropriately:
For URL parameters (comma-separated):
For JSONata filters:
For regex matching:
Hidden Variables
Some variables shouldn't be shown to users but are useful for queries.
Hold intermediate results
Creating a Hidden Time Variable
Create a variable that converts Grafana's time to ISO format:
Variable (completely hidden)
Query configuration:
$fromMillis($number($.time))
This converts the epoch milliseconds from ${__from} to ISO format.
[SCREENSHOT: Hidden variable configuration]
Complete Example: Site > Machine Dashboard
Let's build a dashboard with chained site and machine dropdowns.
Variables to Create
machine – Machine dropdown (filtered by site)
Variable 1: Site
Variable 2: Machine
$filter($.data, function($v){ $v.site = "${site}" })
Using in Panels
Production Runs with OEE:
This returns production runs for the selected machine with OEE scores (productivity, availability, performance, quality) per run.
Variables (Sensor Data) Query:
Variable Display Options
In variable Display settings:
Display
Description
Best For
Custom All Value
When "Include All" is enabled, you can customize what value "All" represents:
Troubleshooting Variables
Variable Shows No Values
Causes:
Fix: Test the same query in a panel first.
Chained Variable Not Updating
Causes:
Refresh not set correctly
Parent variable name typo in filter
Fix: Set Refresh to "On dashboard load" and verify variable name in JSONata expression.
Cause: Not using proper format modifier
Fix: Use ${variable:csv} for comma-separated or ${variable:pipe} for pipe-separated.
Naming Conventions
Use lowercase: site, not Site
Use underscores: machine_uuid, not machineUuid
Be descriptive: production_line, not pl
Filter data in variables, not just in panels
Use "On dashboard load" refresh for dependent variables
Avoid excessive API calls with proper caching
User Experience
Hide technical variables from users
Order variables logically (site -> machine -> variable)
You've learned to create dynamic dashboards with variables:
Query variables from the ENLYZE API
Chain variables for dependent dropdowns
Use variables in Infinity queries with ${variable} syntax
Create multi-select and hidden helper variables
Continue with:
Quick Reference
Variable Query Settings
Common Root Selectors
Purpose
JSONata Expression
$filter($.data, function($v){ $v.site = "${site}" })
$filter($.data, function($v){ $v.machine = "${machine}" })
Variable Modifiers
Refresh Options