How to bind an input variable in a BigQuery WHERE LIKE clause

I am not having much luck getting the variable substitution to work in a SQL statement when using the LIKE '%{{inputModal.value}}%' to perform a search of a specific string based column.

If I replace the {{inputModal.value}} with a real search value then the query fires as expected but no luck with trying to bind to the value entered through the input form in the App.

Looking at the SQL Prepared statement and hovering over the like statement, the substitution from the input appears to the working but something is not working when executing the query.

Also of note, if I use a WHERE clause with a simple equality match then the bind to the input value works as expected. ie WHERE Email_Address = {{inputModal.value}} so it appears to be isolated to the LIKE operator.

Any suggestions appreciated.

Hello!

You can try LIKE {{'%' + inputModal.value + '%'}} in your query.

You can also write your own statements in a javascript query and use the output to set a parameter declaration value and then just EXEC(thatStatement) Example EXEC

2 Likes

Thanks @pyrrho your suggestion worked as expected. appreciate your suggestion.