Is there a way to store data returned from server into a viewstate in KX Dashboard?

https://learninghub.kx.com/forums/topic/is-there-a-way-to-store-data-returned-from-server-into-a-viewstate-in-kx-dashboard

Hello,

Here is my use case: I am trying to build a dashboard where each user can construct a dataset S for viewing, and user can further interact with S using various controls. Here are the problems I have:

  • although S itself is small, computing S takes significant amount of time, and there are various interactive components on the dashboard that depends on S as data source so they need to query S over and over again

  • S is different for different users

My idea for solving these problems is to cache S for all users on the server side, and for each user, once they compute their S, they can just looked up the cached S every time they need S again. However this solution would require the server being able to send a key for S back to each user, and I have yet to find any documentations on how KX dashboard could use data returned from server as value to assign to view state. Did I miss something or is there a good reason for not having this capability? If the latter is the case, what other solutions can I try for my use case?

 

Thank you very much in advance!

Hello @yuwu10112358

Thanks for sharing with the KX Community.

Reverting with some feedback for you:

There are a few options here:

  1. Server side caching solution is recommended.

  2. Use a virtual query. If several components are using the same datasource, then there can be one q query and link each of the components to a virtual datasource

  3. In the query, return the table as a dictionary and use the query mapper to map the table to a viewstate

Hope this helps.

Thanks,

Leah

 

https://code.kx.com/dashboards/datasources/#mapping

 

https://code.kx.com/dashboards/action/#viewstate-mapping

 

 

Thank you for the feedbacks! Sorry if this is a dumb question, but what is a query mapper?