# Ad hoc Value as variable

**URL:** <https://community.grafana.com/t/ad-hoc-value-as-variable/4674>\
**Category:** Grafana\
**Created:** [January 5, 2018, 7:03pm UTC](https://community.grafana.com/t/ad-hoc-value-as-variable/4674 "2018-01-05T19:03:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![osmorga](https://avatars.discourse-cdn.com/v4/letter/o/5daacb/32.png) [@osmorga](https://community.grafana.com/u/osmorga)\
**Post date:** [January 5, 2018, 7:03pm UTC](https://community.grafana.com/t/ad-hoc-value-as-variable/4674/1 "2018-01-05T19:03:25Z")

</div>

Hello, is there a way of using the value of an ad hoc filter as a variable.

![image](https://us1.discourse-cdn.com/grafana/original/2X/9/94623cd7ca52d8512eb8062ffb55788852e9a715.png)

using something like $dimension.value return ‘90’ ?

Im trying to use that value in a Query template

---

<div class="post-metadata">

**Author:** ![dcech](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/dcech/32/49_2.png) [@dcech](https://community.grafana.com/u/dcech)\
**Post date:** [January 5, 2018, 8:20pm UTC](https://community.grafana.com/t/ad-hoc-value-as-variable/4674/2 "2018-01-05T20:20:54Z")

</div>

Add `code` as a regular template variable, otherwise your query has no way of knowing whether the user has added `code` as an ad-hoc variable or not.
