Use module (data) input variables as query parameters

Hi all!

I'm very new to Retool and am currently testing it out to see if this is something for my company. So far I am really impressed! That being said, I'm running into some trouble currently.

I have created a module and added a data input variable that I would like to use in the WHERE clause of one of my SQL queries. However, that doesn't seem to work.

If I hardcode the value, everything works as expected:

However, if I declare an input variable of type data (1) and update my query to use that variable (2), whenever I add a test value (3), I get empty results (4):

I've tried wrapping the test value with single and double quotes, but nothing seems to work. Am I doing something wrong?

Thanks in advance!

PS: I'm using the beta Retool DB :wink:

Also, is there a way to print the query after the variables have been parsed? That might help me debug :slight_smile:

Ok, figured it out. Leaving this for future reference.

The docs on data input variables state "A data input is a property—a string, object, number, or boolean—that apps can pass into your module.", which is a tiny bit misleading. Apparently, all data type input variables are objects. By calling .value the query succeeds.

I discovered that hovering over a variable shows you a tooltip with an inspect button (1). That opens a little inspector with a console, which was helpful in debugging the issue.

1 Like