Passing essql statements in Workpad Variables

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?

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) your query with the var so your expression might look something like:

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:

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!

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