Dynamically specify a resource in a module

Hi,

We are facing some limitations with the module implementation.

Our use case, we have multiple apps with different resources (different databases) but the queries are essentially the same.
Our goal is to encapsulate those queries (along with a table component) inside a shared module and dynamically set the resource when using the module.

Any ideas or tips for us?

Thank you,

Dusty

2 Likes

Hi @dusty-campanella-maxa !

I don't think this exactly does what you're trying to do (you will still need to have the resource/query within the app that the module lives in), but my workaround for the time being is to use the input data variables within the input section of the module.

The only tricky part is that in order to populate the column names and have the ability to format them is to set a default in the data input and populate the table with that within the module. And then you can format the columns as you'd like. The default data that you use would need to have all the possible column names you plan to use.

And then within the app that the module lives, in the Inspect section of the module you'll set the input data variable to be the data you want to use to populate the table.

Example within the edit module for setting the input data variables:

Hope that helps and look forward to seeing any other possible solutions!

Thanks!
Scott

@dusty-campanella-maxa

Thanks for the feature request! I realize there are probably many use cases where you would need the query to be in the module, but depending on the complexity of your module you might be able to get away with making the queries in your apps and passing the data in as module inputs.

Hey team!

Are there any updates on this feature request? We are facing the same problem and would like very much to have a single app where we could dynamically specify what resource to use.

1 Like

Hey! No updates yet, sorry :confused:

Any updates? I'd like to trigger a query in a submodule from the parent app, or be able to reset a table within it when a query runs in the parent app.

Thanks!!

Yes @xoel!

There's a beta feature that's available for all Cloud orgs as well as self-hosted orgs that are on version >2.97. Let us know if you're interested and we can look into turning it on for you :slightly_smiling_face:

The feature introduces a new fx toggle next to the resource in a query.

From there, you can use the Resource ID field to pass the ID of the resource the query should run against. You can populate this field with the selected value of a dropdown (eg {{select1.value}} ), the results of a query (eg {{dbLookupQuery.data.db_id}}) or any other value available in your app.

There are three methods to retrieve a list of resource IDs to reference:

  1. Manually. Users can retrieve the ID of a resource from the url of the resource’s configuration page. The ID is the x character string following /resources/. For example: https://demo.retool.com/resources/b49d8ef2-a774-433f-9b5c-cadd2a60c678
  2. Using the underlying Retool storage database. Users on self-hosted instances of Retool can query the underlying Retool database to fetch a list of resources.
  3. Using the Retool API. Users can query the /resources endpoint of the new Retool API to fetch a list of resources, filtered by the desired resource type.

Hello, I would like this feature to be turned on for me.

Done!

Could you also turn this on on my organization?

Yes! It should be turned on now, let us know if you run into any issues!

For future reference - if you'd like this turned on it'd be great if you could reach out to us directly (via in-app chat or DMs) just to keep it so that this thread is mostly questions/answers about the feature or any updates around it :slightly_smiling_face:

i submitted the DM but I would like this added to my hosted account as well

Hey @Kabirdas,

how to enable this feature for the on-premise release? Is it one of the toggles in the "Beta features" tab or do you need to enable this on your site?

Where is the list of potential beta features we might be interested in?

Best regards,
Michal Grzelak

Yep! This is available for self-hosted orgs as well, if you write to us directly we can turn it on for you :slightly_smiling_face:

There are a number of features at different stages of experimentation that the engineering team is working on. How they're shared out depends largely on the individual project and we don't have a central location where all beta features live at the moment. It is a process the team is looking to streamline though! And generally, if you share issues you're running into with us we're pretty eager to check if there's something being developed that might help you.

Hey @Kabirdas, can you please activate this feature for us also? Thank you!

Hi @Kabirdas

Our use case is similar, in that we have same databases in different AWS datacenters and want to parameterize the resource ID in order to select the resource from each datacenter.

Would it be possible to enable the beta for us as well?

Thanks a lot!

@Kabirdas we are self-hosted can you turn this feature on for us?

Hey Mr @Kabirdas , would love to have this activated as well for TROOPR. Didn't find a quick way to do a DM directly.

Turned it on for you!

Please could you turn this feature on for us as well @Kabirdas