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:

First, create a module input, you can find this setting on the Inspector (right-side panel) when you open the module. 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.

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

Finally, 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.

TriggerModuleQuery.json (9.4 KB)

9 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