KTL - Linked filters for reports only

Hi all,

I am trying to use the ktl linked filters feature to update filters on other reports. My current set up is 4 pie charts all from the same data source, they are all currently in the same view.

The video tutorial by @NormandDefayette_CortexRD seems to only show how to link to a table _lf=“table name”, but what do i put if there is no table? Do i put the lf in the description of the first pie or in the description oif the view itself… I feel like i have tried a few different ways and cant seem to get it working. I know for sure its going to be obvious, but i have probably stared at it too much. Any help is appreciated

as an example this is what I’m trying to achieve:

https://ctrnd.knack.com/ktl-tutorials#driven-by-reports-with-tables

Hi Chris

If you look at the the wiki here:

It says that _lf is only supported in grid views.

I’m sure if you raise it as an issue in GitHub Norm may add this as a feature for you.

Craig

Hi,

The demo shows it working for the reports… The video tuturial suggest that it should be placed in the first report but doesnt seem to show what excatly to put in, as it then continues to show how the report can drive the grid, and shows it being linked.

I may be over looking something with this

Hi Chris

After looking at his code you are right my apologies. Have you tried using the viewId of the report view i.e.

_lf=view_123

replace 123 with the id of your report view.

Craig

Thank you, Thats worked! I think i was getting stuck as i had multiple reports in 1 view and trying to link them.

Is there anything in the code that would suggest i can keep them in the same view, or am i best splitting them into separate views. Ideally i dont want to split them as there are already 4 views for the various user permissions each containing 4 reports. This would mean i end up with 16 views on the page just for these reports.

Hi Chris

It should work based on the view, so all reports in that view should be linked. This isn’t a feature I’ve used but that is how I think it will work based on the code.

Craig

Thank you for coming back to me.

Currently the reports in the first view doesn’t update with the main report. I guess i could add 3 of the 4 reports to a second view, rather than having 4 seperate views. But is there any way to have all 4 reports in 1 one view and link them. For info i have tried adding the lf with the view its contained in but this just cause an update infinite loop.

Another approach, that I have used, is to add a single line grid view at the top of the page, set up the filter on it, add the _lf to it, then hide the grid using javascript so all you see is the filter, which then becomes a filter for the whole page.

That javascript is:

$(document).on(‘knack-view-render.view_NNN’, function (event, view, data) {
$(“table.kn-table”).hide();
$(“.kn-table-wrapper”).hide();
});

As per below image

Ends up looking like this …

1 Like

Thank you for this! For now i have added the second view and kept the primary report in the first one with the filter and the other 3 in the second view which the _LF points to.

I like your method, so will look to use this on some of the other pages as the page layout will look odd if i continue with the current way, where as yours keeps the view in tact completely.