Stored procedure parameters for global queries

  • Goal: Using sprocs globally without referring to specific retool elements by name

  • Steps: I've got retool running against Azure SQL with parameterized stored procedures just fine, but I can't figure out how to use them repeatedly if they're global in nature, like one that performs a calculation with a variety of different parameters. Some of these would be per-user parameters, while others might be global to the app. As an example, the user change have filters to show a different cycle_id.

My options appear to be:

  1. Reference specific elements, like select1.value - but this doesn't really make sense when I want to use it many times with the parameter set from many different places.
  2. setting local storage everywhere and updating it
  3. using queryparams

but those all seem more complex than what I need. Is there some way to do this that I'm just not seeing, that would let me send the parameter values whenever and wherever I want to use it? Or have I been staring at this too long, and I'm missing some sort of design pattern?

Hey @Eric_Engelmann! Thanks for reaching out.

At a high level, the primary issue with this is that a single query is limited to having a single return value at any given time. While it's definitely possible to parameterize a query, re-triggering it with a new set of inputs will overwrite the data it was previously associated with.

I don't think it quite answers your question, but you could define one generic sproc that you trigger with additionalScope. It would have to be triggered from within another JS query or as an event handler, though.

1 Like