How to parametrise queries


Is it possible to use queries with a parameter that can be passed in at the point the query is used to fill fields?

My use case: I have a number of fields that use the same query to get a value to fill them, but each place uses a different source field for the parameter to the query.

eg form with tabs: each tab has a ‘project’ field, selectable by the user. each project field then holds the parameter to a query to fill another field down. It seems silly to have to create an identical query to fill each of these fields on each tab, just because the query can’t be parametrisable - or can it?

It seems when you define a query (at the app level), you have to define the value of any parameters as well - which seems to completely lose the point of parametrisation.

If I create a query at the resource level and share it, I can create a parameter, but then to use it, I have to reference it from an app-level query, which then requires that parameter to be specified for each use - again rendering the parameter redundant.

Am I doing something wrong?

Thanks in advance,



Any response from retool?



Hey @jconroy - sorry for the delay, this slipped through the cracks :slight_smile:

The answer right now is no - there’s no way to parameterize the resource that a query pulls from. You need to manually decide which database / API your query is using from the dropdown. The workaround is to use a JS Code query that conditionally triggers whichever query you want to use, but as you mentioned, that still requires you to set up identical queries on different resources.

On your end - what are the different resources?