Filter table with url parameter

  • Goal: I want to filter a table with a url parameter

  • Steps: I´ve set up a url parameter:

When I type into my browser:
https://drgreen.retool.com/app/faq#id=115

the app opens but the parameter value is deleted
it looks like this:
https://drgreen.retool.com/app/faq#id=

when I manually add "115" as value and reload the page, the filter works just fine

What do I miss??

PS:
I have worked with the standard searchTerm feature to prefill the search Filter, but this is not what I want, as the results are not exact, sometimes I do get more results than I want because I´m looking for the id of a specific entry of the list.

Hey @TomJaud,

Where are you accessing this retool app from?
If it is from inside retool you can use the "go to app" event handler to open with the desired url param:
image

1 Like

@TomJaud How are you passing the id into the URL params to begin with?

I second @GuilhermeSilva's point that you can use the 'go to app' event handler to open the app with params you pass in from that GUI and you can dynamically set that to always be a value from a query or component.

if you are looking for a way to store a number to pass in to a query, you can set a Javascript variable to hold this data as well!

Hi,

my goal is to create an url to share.

Everyone in my team who clicks the url should be able to see the desired filtered table.

So, no, not within retool. But from "outside".

Hi @TomJaud

Thank you for the details.

You can set up a JS Query to run on page load, and it that query you can programtically add a filter to your table, using the table.setFilter method!

Then once you deploy your app with the play button in the top right and the behavior is as intended, you can generate a link to share from the 'share' button in the top right.

The query if set up correctly should run and apply the filter to the table so that users who view the app from the link will see the data filtered as intended.

Hope this helps!