Module Input Data

Hi, I have a module (myModule1) which I have included in an app. I have a single input of type data (myInput). I can set the value of this input by inspecting the module and entering the value in the textfield provided. However I want to be able to set this input dynamically via a run script and I'm really struggling to do this.

I have tried various combinations of the following but it doesn't seem that I can change the input of a module dynamically.

e.g. myModule1.myInput = "Hello"

I'm fairly new to Retool but I have been through a number of forum posts but I'm not finding the answer to my particular problem.

Thanks for your help

Hi Simon,

For this functionality, you would need to set up an input that gets exposed to the application that will host your module. You can then connect that input to a component or query in the application. After this, then you can listen to any changes to that input from within the module.

For instance, you set an input called myInput in your module and initialize it as an empty array. When you add your module to the application, you edit the module in the basic field in the edit pane and point myInput at a component/query/state within the application (for example, helloState.value). You can now set up queries that run automatically when applicationState changes in your main application.

@petermdamato Thanks for help, that worked perfectly.

1 Like