Sql Table data display through listbox select

Hello!
To start off, I am still rather new to Retool and Javascript as well as SQL.
Okay what I want to do: I have a database with a table called experts. the connection worked well and as such I have the data in my retool app and loaded said data into a multiselect listbox. (Slight tangent, I want to display a lot of data but said listbox only has a limited amount, I saved the ID in the prefix icon, is there a better way?) From said multiselect listbox I now want to display a container when only one element is selected:


I have tried to hide the info, as it could me personal.

The issue I am having is that I have only found a way to display that data with queries and they are called each time I select another item in the list which always takes a bit of time.

My idea was to select * from the table and load it into an array but I haven't found a way to do that. If you can tel me how or if you have another solution please let me know!

Also if you need more info, let me know!

Thank you in advance!

Hey @Katunga

Can you share screenshots of your query? How are you setting the resource? Thanks :slight_smile:

Hey @Katunga i think you just have to use a Transformer instead of a Js query.

Simply create a transformer that returns nothing if 0 or more than 1 items are selected in your multiselect listbox. If exactly 1 item is selected, this transformer returns the singular selectedItem (0th element of the selectedItems properties of your mulitselect listbox).

Now you can use this transformer to both:

  1. Show/hide your container
  2. Show data in your container

Import and check out sample retool app below:
Sql Table data display through listbox select.json (18.8 KB)

1 Like