# Test if a dashboard variable is set before using it

**URL:** <https://community.dynatrace.com/t/test-if-a-dashboard-variable-is-set-before-using-it/45335>\
**Category:** DQL\
**Tags:** log-analytics, dql, dashboards\
**Created:** [April 29, 2024, 7:12am UTC](https://community.dynatrace.com/t/test-if-a-dashboard-variable-is-set-before-using-it/45335 "2024-04-29T07:12:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [June 9, 2024, 10:00am UTC](https://community.dynatrace.com/t/test-if-a-dashboard-variable-is-set-before-using-it/45335/3 "2024-06-09T10:00:16Z")

</div>

You can check for variable values with a code snippet, if the value you expect is set then continue with the DQL

```markup
export default async function () {
  if ($important_filter != "expected value") {
    return null
  }
  // execute DQL...
  ...
  return data;
}

```

> **[Grail DQL query API | Dynatrace Developer](https://developer.dynatrace.com/develop/sdks/client-query/)**
>
> Exposes an API to fetch records stored in Grail.

---

_[View the full topic](https://community.dynatrace.com/t/test-if-a-dashboard-variable-is-set-before-using-it/45335)._
