New to Retool. I have a very simple issue with passing a value resulting from a a select tool pick.
The select tool correctly displays the desired list from my database and saves the selection as {{select1.value}}. I am able to confirm by displaying {{select1.value}} in a text box.
However, when I query my data (organized in a Retool database) with the following, I get the correct label back but the value is just blank.
SELECT make FROM "Cardata" WHERE equipment = {{select1.value}};
The query editor tells me that {{Select1.value}} is undefined. The data in the database is correct and should return a value.
This has got to be a simple problem to fix, so any advice would be appreciated.
I ran it in the code editor. When I hard code in a value, it functions properly. When I reference {{select1.value}} it returns a blank. Screen shot below
The screenshot shows that Retool doesn't recognize the select1 reference. How is it created in your app? Can you share a screenshot of the component tree?
When you hover over the .value in the SQL, does it show the value of the component? If so, have you enabled using dynamic references within the SQL editor. For me, this option was not enabled by default.
It seems like your screenshots might be using the query library. If that is the case, component values won't be in scope within the query library. You'll need to create a dynamic variable on the query library query. Then, once you import the query into your app, you can pass the select value into your query.
In the query library, you'll create a variable using {{}}. You can put any variable name inside the {{}} and you can put any test values in the variable field on the right (replace {{select1.value}} in your query with {{some_string_here}}):
In the app, import your query & pass in the select value: