Linking filters across multiple reports

Has anyone ever found a way to set up a filter that will update multiple reports at once? Its quite usual to have a line graph/bra graph side by side with a table showing the same data in different ways. Users would like to be able to set ONE filter and adjust both views at once (not make the same adjustment on both). But in Knack, all those filter views are standalone. Is there any way to filter both at once in code or otherwise?

As a makeshift, you might create a new object ‚Filter‘ and combine this with a set of Page rules showing/hiding select pre-filtered objects.

Thanks Wolfgang, exactly what i ended up doing - but of course it adds considerable complexity to the app …

However, I’ve really found this approach to quite limited. For example, on a Dashboard there may be 10 different graphs with 10 different filter options, so this creates a really complex set of page rules that is almost impossible to manage.

So just reopening the question to see if anyone knows of a way using JavaScript or whatever to have a filter one one graph change the filter setting on other graphs as well?

The easiest way for me to do something like this is to write my own interface in another tool - like Shiny. It would be great if this was built-in.

Hi to all,

I’ve seen this request at 9:30 this morning. I have completed the code update in the KTL and here’s the result.

Linked Filters feature in KTL

The first table is the main one driving all other filters.
As a bonus…

  1. if you change the Number of records per page, the other tables will apply the same
  2. if you Search some text, it will be searched in other applicable views
  3. if you modify the Sort column and order, the other views will follow
  4. you can save your filters to named buttons by clicking the yellow diskette icon.

There are still a few glitches with the reports, but hey… I’ve only put 2 hours of coding time in this yet. I will fix those down the road.

All you have to do to have this feature is copy 5 lines of code from this GitHub page and add the linked filters keyword _lf to your main table’s title or description, like this:

_lf=viewTitle1, viewTitle2

Let me know if you like this.

Have fun!
Normand D.

Nice, seems to sync filters on RECORD views but not REPORT views. (even on your demo page the Stores 4 view doesn’t sync). So I cant really use it for my current use case until reports are working too. Great start though - kudos to you.

Hi,

I knew the report were problematic. But I tackled the problem this morning and found a solution. It’s not perfect since it forces a refresh of the whole page, but it does the job, and I’ll find an elegant method later. Actually, it will do this only if there’s at least one linked report in the scene. If all tables, it will refresh those linked tables only.

Also, at the moment, the main driving view must be a table. I will eventually make it work with any type of view.

Go ahead and give it another try please.

Norm

That’s definitely working with the report views now, so good work there. I still cant deploy it because I don’t have the opportunity to add a table view to the dashboard (its just a bunch of reports), but I can see that once you’ve found a way to have the “master” be a report then this would be very useful indeed.

Another small bug/niggle that will then become more important is that the right-click popup on saved filters is vertically truncated in a report view, so the delete option is chopped off. Once the report view is the master, this will need to be visible. You can see this is your demo page if you save a filter then right-click it, as per below - but only gets truncated on the report views. I think its because there is no SEARCH box on report views, which means that popup doesn’t have a enough room at the top of the view. Not sure how to resolve that.

image

Hi Leigh,

I think I’ve got it now. You can go try it in that same page above.
I’ve also created another page with more reports for you. The first one drive all others.

https://ctrnd.knack.com/ktl-tutorials#reports

I found out that it wasn’t possible to save user filters when not logged-in. I fixed that too.
About the truncated context menu, it’s also fixed for the location of the box. But the tooltip is still truncated - to be fixed soon.

Norm

Linked filtering on reports works well now, apart from tooltip as you mentioned but that’s not a showstopper by any means. Great stuff.

So in my very quick testing I note that saved filters are personalised - i.e. they only show fpr me, but not for others. Which is fine.

But is there a way (or are you planning a way) to also have universal saved filters that show for everyone?

Hi Leigh,

Thanks for contributing to the KTL testing!

Regarding your “everyone filter” request, I invite you to read (all!) the KTL documentation, as what you’re referring to already exits and are called “Public Filters”.

It requires a bit of setup, but it’s very reasonable and simple to follow.

Norm

Great, will read today. Also, I found a way around my last barrier- I didn’t want to have to label my pivot table views (as they sit side by side with the graph showing the same information) but found that your software finds the label even if its wrapped in html, as in: "font color="white "Leads by Region/font (with angle brackets, but if I put them here the text vanishes) so that the label is technically invisible to the users.

And I also find that I dont require filtering to be visible on the linked views, just the master. So that its feasible to set up ONE FILTER on a page that drives all views, with all other filters hidden, which will avoid confusing people.

Nice work.

Wow, that’s awesome!

You’re discovering features-within-features that I didn’t even know existed!
Thanks for letting me know about them.

Tell the Knack world about the KTL if you will. It really needs a push :slight_smile:
Users (aka contributors) like you really make a huge difference.

Cheers,
Norm

Thanks for this @NormandDefayette_CortexRD - I can’t get the filters across reports replicating here https://ctrnd.knack.com/ktl-tutorials#driven-by-reports-with-tables but it does from the first report to the table (the last view).

I just checked and I think you’ll find that the filter EFFECT is replicating across all graphs - for example set “Amount < 20” in the top graph filter and it will update all the other graphs to only show things under $20 - but the actual filter DESCRIPTION is not appearing on the other graphs.

In my case that isn’t an issue at all because I actually turn filtering OFF on the other graphs - the filter EFFECT still carries through, but there is only one filter left visible on the page - on the first graph - so its way less confusing for users - just one place to set a filter.

You are right Leigh. Actually, I show this little buggy detail in my new video just released 10 minutes ago - my first KTL tutorial. You are the first guys to know about this! Actually, the HD version is not even finished compressing by Youtube.

You can go see it here: Cortex R&D on Youtube

I think that the video shows pretty well how the KTL can be useful and easy to use.

Cheers,
Normand