Trying to use temp state or local storage to create a list from other tables

I am using a mongodb resource that has a collection containing file metadata. My retool app has 3 tables. Table one uses a query to group files and display all the group. Selecting a group will display the files in that group in table 2. I have multiselect with checkboxes set up in table 2. What I am trying to achieve is to use the check box to select files in table 2 and have them show in table 3. So I am looking through all these groups of files and selecting them to create a list that shows up in table 3. I can't quite get it working because I need to be able to view different groups and files in tables 1 and 2 and have those previous selections stay and display in table 3. I've been toying with a temp state and local storage but haven't got it. I appreciate any advice and thanks in advance.

Hey @bobbintb!

This sounds interesting, I'm super curious to see what you've built so far. My first reaction here would also be to use a temp state, maybe something indexed by the id of each row and values corresponding to whether they've been selected? You could also pass their index as a property to the temp state, or use an editable boolean column so you have access to mappers :thinking:

In short, I think this is a great question and there are a couple of ways to go about it! If you share what you have maybe we can recommend some tweaks, and otherwise I'm interested to hear how others might solve this.

The end goal is a duplicate file search tool for my NAS OS. Here is what I have so far:

For now I just decided to add a field in the db. I couldn't get local storage or state to work properly. I might keep it that way because I think the persistent state works better for this application. I'm not sure how to share a read-only editor view.

Creating a field in your DB sounds like a good way to go though!

For future reference: If you create a JSON export of your app we can see its structure in our own instances without it being connected to any of your instance's resources, that can be useful here! Otherwise, folks on the Retool team can step directly into your app with your permission as long as it's cloud-hosted (folks will usually write to us directly for that).

Also, if you're curious, I've attached a sample app you can mess around with that uses set in to store copies of the selections made for each row in table 1 under its corresponding index within a temporary state. If there are duplicates between the groups you'd likely want to use a different pattern, like a flatter temp state that's just indexed by each record's id.

1 Like