Filter table based on parent window url

Hi there,
Complete Retool newbie here. I am wondering if it is possible to filter a postgres data source oby of the URL of the parent page?

eg. If I embed an app on my website at https://website.com/1234 can I have a table in that app filtered by column_value = 1234?

Hey @Henry!

You may be able to use a ParentWindow query (referenced here) for this. I don't know of a way to query the parent document object directly but if you store the page's URL in a DOM element you should be able to access it.

Say you have something like

<div id="page_url" hidden></div>

on your webpage and then set its value to be the page's URL in the same script where you embed Retool using something like

document.getElementById("page_url").innerHTML = document.URL;

You can then run the following query:

Which should return the URL you've stored in that element.

Could that work?

1 Like