# How to use variable in canvas

**URL:** <https://discuss.elastic.co/t/how-to-use-variable-in-canvas/303842>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [May 3, 2022, 1:50pm UTC](https://discuss.elastic.co/t/how-to-use-variable-in-canvas/303842 "2022-05-03T13:50:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![probson](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@probson](https://discuss.elastic.co/u/probson)\
**Post date:** [May 3, 2022, 1:50pm UTC](https://discuss.elastic.co/t/how-to-use-variable-in-canvas/303842/1 "2022-05-03T13:50:20Z")

</div>

Hi,

I am trying to use canvas variable's within ESQL query and cannot work out the syntax, I have it working within Markdown but cannot work it out within my query, I've searched the support and discuss and tried a number of examples but cannot get it to work.

```auto
WHERE "@timestamp" > TODAY() - INTERVAL 30 DAY AND organization.name={var "Org"}

```

---

<div class="post-metadata">

**Author:** ![probson](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@probson](https://discuss.elastic.co/u/probson)\
**Post date:** [May 9, 2022, 3:05pm UTC](https://discuss.elastic.co/t/how-to-use-variable-in-canvas/303842/2 "2022-05-09T15:05:12Z")

</div>

I managed to get this working, I needed to modified my query in expression editor and modify the query to

```auto
query={string"

```

When using the gui it misses out the {string

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 6, 2022, 3:06pm UTC](https://discuss.elastic.co/t/how-to-use-variable-in-canvas/303842/3 "2022-06-06T15:06:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
