Use View States

This page outlines the essential concepts you need to understand when working with view states in KX Dashboards.

View States are dynamic variables that store values accessible across all components in a dashboard. They enable seamless interaction between user inputs, visual components, and data queries.

By leveraging view states, you can build highly interactive dashboards that respond to user input and reflect real-time or filtered data without manual reconfiguration.

What are view states?

View States act as shared parameters that can:

  • Capture user input. For example, from dropdowns or text fields.

  • Pass values between components. For example, in a dashboard used by an FX analyst you could use a view state to pass a chosen currency pair from a dropdown to multiple components, such as charts, heatmaps, and news feeds. This keeps all components in sync, updating automatically based on the pair selected from the dropdown.

  • Dynamically update queries based on user interaction. For example, in a dashboard created for an operations analyst monitoring high-frequency trading data you could have a time window selected by using a date range picker. This input updates view states like startTimeand endTime, which are passed into queries powering a real-time trade volume chart and a latency heatmap. This automatically filters large volumes of records to show only the relevant slice of data.

These capabilities make dashboards more responsive, personalized, and efficient for data exploration and decision-making.

Creating and managing view states

To manage view states effectively in KX Dashboards, you can access the View State dialog, create new parameters with defined types and defaults, and organize them using folders for better structure

  • Access the View State dialog via the eye icon at the top of the properties panel or in any property that it appears.

  • Create new view states by specifying a name, data type (for example, string, int, datetime), and optional default value.

  • Use folders to organize view states and manage them efficiently.

Screenshot

Use view states in queries

View states can be integrated into queries, enabling dynamic filtering and interaction based on user input.

  • In kdb+/q, view states can be passed as function parameters or embedded directly in queries using <%param%> syntax.

  • In SQL, use {{param}} to inject view state values into queries.

  • View states can be mapped to query results, enabling dynamic filtering and interactivity.

View state types and features

View states offer flexible data handling, dynamic time-based updates, and tools to keep your dashboard configuration clean and efficient.

  • The support a wide range of data types including lists, timestamps, and symbols.

  • Rolling View States allow time-based values to update dynamically. For example, current minute or day.

  • Unused view states can be cleaned up to maintain clarity.

Visualize view state relationships

The View State dialog includes a graph view showing how each view state connects to components and data sources.

Components can be renamed for clarity in the graph.

 

Further reading