Trigger a module query from the parent app

Currently, the best/only way to trigger a query inside a module FROM the parent app would be to use this workaround:

  1. Create a module input (this is a setting on the left side of the page when building your module) and set the value to be the parent query or the parent input that you want to use to trigger the module query. In this example, I want to trigger my module query whenever my parent app query, titled parentQuery, runs.

  2. (a) Create a "Query JSON with SQL" dummy query that runs (b) select * from {{input1.value}}. This watches for changes to input1 and triggers this query on any changes. Then, (c) add a Success event handler to this dummy query that triggers your target module query.

  1. Now, in your parent app, just make a change to whatever you set input1 to (in the module) and you should see the module query get triggered!

I've also attached an export of the module used in this example so you can look around if that's helpful at all :slight_smile: You can import this JSON file by clicking Create new (on your Retool organization's home page) > From JSON.

Trigger module query.json (8.4 KB)

7 Likes

5 posts were split to a new topic: Clear an input field in module from parent app not working

9 posts were split to a new topic: Temp state causing module to re-render

2 posts were split to a new topic: How can I trigger a module query, but not on page load