# Passing essql statements in Workpad Variables

**URL:** <https://discuss.elastic.co/t/passing-essql-statements-in-workpad-variables/284367>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [September 16, 2021, 7:33am UTC](https://discuss.elastic.co/t/passing-essql-statements-in-workpad-variables/284367 "2021-09-16T07:33:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CalvinHobbes](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@CalvinHobbes](https://discuss.elastic.co/u/CalvinHobbes)\
**Post date:** [September 16, 2021, 7:33am UTC](https://discuss.elastic.co/t/passing-essql-statements-in-workpad-variables/284367/1 "2021-09-16T07:33:31Z")

</div>

I am trying to pass essql statements in Workpad variables, but the elements are not recoqnizing it as valid essql statements. I suspect it has to do with escaping of special characters: is this possible to do?

---

<div class="post-metadata">

**Author:** ![poff](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poff/32/81795_2.png) [@poff](https://discuss.elastic.co/u/poff)\
**Post date:** [October 1, 2021, 1:59pm UTC](https://discuss.elastic.co/t/passing-essql-statements-in-workpad-variables/284367/2 "2021-10-01T13:59:29Z")

</div>

Hey there!

Because of how expressions are parsed and executed, in releases prior to 7.14, you'll have to string concatenate (using this function: [Canvas function reference | Kibana Guide [7.15] | Elastic](https://www.elastic.co/guide/en/kibana/current/canvas-function-reference.html#string_fn)) your query with the var so your expression might look something like:

```auto
essql {string "select * from " {var "indexName"}}

```

Using that string concatenation like that will work but can also be a hassle which is partly why we now support the use of parameters as of 7.14.

The essql function now can accept multiple "param" arguments so you can have an expression like this:

```auto
essql "SELECT YEAR(release_date) AS year FROM library WHERE author = ? GROUP BY year" param={var "authorName"}

```

Let me know if something like that works for you!

---

<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:** [October 29, 2021, 1:59pm UTC](https://discuss.elastic.co/t/passing-essql-statements-in-workpad-variables/284367/3 "2021-10-29T13:59:56Z")

</div>

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