While creating a custom visualization how do i access filters that are selected in the dashboard? I have a dashboard with date range selector and a few other filters.
Already have an account? Login
Login to the community
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Ok, that makes sense, but is not currently available, the closest you could get would be to send the ajax to a listener service that would then call the Looker API to get the filters from the dashboard. The issue with that is that it will only get the dashboard’s saved filters, so a user making changes to the filters (fields or values) would not be pulled through unless they saved the dash every time they make changes. Thanks for outlining your use case though, I’ll bring this up with the team 🙂
Thanks Will. Mainly i am trying to define a new custom visualization which will sit in the same dashboard as the other Looker supported visualizations. The only change is that the custom visualization will call our custom backend API via ajax and get data to be displayed. All the visualizations (including the custom viz) in the dashboard should honor the filters like date range selected, content ids, age, gender, etc.
Ah I see, you’re wanting to get the current filter values, not to assign filter values. There is not currently a way to do so, the closest you can get right now would be to examine the queries from each tiles and see what fields they have in common in their WHERE clauses.
What’s the end goal here? I can help try to find a workaround if this is an means to an end, and not the end itself.
Thanks for the quick response Will. Is there a way to print all the existing filters to be able to see what kind of data i am dealing with?
Since the dashboard-level filters alter the query of each of the looks in the dash, you can access it with the look-level filter api as outlined here (toward the bottom of the page):