KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Solutions How to link ‘Filters’ across multiple data-grids?

  • How to link ‘Filters’ across multiple data-grids?

    Posted by vice-freak on December 19, 2023 at 12:00 am

    Hey there,

     

    Apologies for the novice question.

     

    I am building out a dashboard with several tabs each having their own data-grid, but all coming from the same table – an absolute behemoth of 200+ columns that only displays certain columns based on which tab you are on (surprisingly most efficient and effective way to display such data, having buttons that filtered the table was a nightmare in terms of speed).

     

    However, they all do share one column in common, with the exact same length and elements, and of a symbol type.  How can I make it such that when you input in a string into the filter of this column, it appears across all data-grids?

     

    I can see there is a way to input a viewstate in both the ‘Filtering’ option under ‘Basic’ as well as under ‘Custom Filters’, but can’t seem to quite get the viewstate right.

     

    Thanks all in advance

    vice-freak replied 8 months, 3 weeks ago 3 Members · 3 Replies
  • 3 Replies
  • megan_mcp

    Administrator
    December 19, 2023 at 12:00 am

    Hi !

    Have you had a look at our video on Querying Data using KX Dashboards? It includes a tutorial on how to create a view state. https://youtu.be/kTYSScDXDHc

    If you still are unsure, let me know and I’ll go in to more detail.

    Many thanks,

    Megan

  • vice-freak

    Member
    December 20, 2023 at 12:00 am

    Hi Megan, thanks for your response!

     

    I am not looking to filter the data at the source so that this is displayed in the data grid. Rather, I would like to apply column filters to my data and have this carry across multiple data grids. I am aware that the process to do so is by setting the same viewstate across all data grids but I am not sure where to link them and what type the viewstate should be.

     

    There are several sections within the data grids for filtering, do I set the viewstate to be the same in ‘KDB Filter String’, ‘Custom Filters’, or some place else? Furthermore, I would be inputting text underneath a header to filter that column, so should the viewstate be type string or symbol?

     

    I hope this provides clarity in what I am trying to achieve.

  • kieran

    Member
    December 21, 2023 at 12:00 am
    {[filterString] .dfilt.apply[dfxQuote; filterString] }

     

    If you have a set of the Datagrids with the same query like above and you :

    1) set the “Filtering” property to “Advanced Column Filter”

    2) set the “KDB filter string” property to same shared viewstate

     

    Then if you update a column filter in table 1, and go to table 2, then the same filter will be applied

    If you then change the filter in table 2, this filter will be applied to table 1

     

     

    If you need any further here, just let me know

Log in to reply.