# Create templates with global variables
To create templates to build interactive dashboards you can use variables via the
[[variable]] syntax. You can learn more about templates and variables in the Grafana documentation (opens new window).
To add variables for assets to a dashboard in Grafana:
Navigate to your dashboard's settings, and then select Variables from the left side.
Make sure the Type is set to Query, and then set your Cognite Data Source as the Data Source.
Specify the query to fetch and filter assets from CDF. For example:
The query above requests assets with the parameter
parentIds=and filters the results by
namethat matches the
For a full list of valid parameters see the API documentation.
Learn more about how you can filter the results, for example by using regular expressions.
You can format variables to fit into the query, for instance if you have a multi-value variable:
The variable will be serialized to comma-separated values in case several assets are selected from the dropdown. Learn more about formatting of variables in the Grafana documentation (opens new window).