Data Filter

 

This page describes how to set up and configure the Data Filter component..

The Data Filter is a server-side filter tool to manage data in the KX Dashboards UI. The output is displayed in a component; for example a Data Grid or Canvas Chart . The following example shows a Data Filter with a nested filter event.

Screenshot

Set up a Data Filter

To set up a Data Filter component, click-and-drag the component into the workspace and configure the following:

  1. Select the data source to filter.

  2. Set a view state parameter for kdb string.

Refer to Data Filter properties described in the next section for details on additional properties.

For an example, refer to build a filter.

Data Filter properties

The following sections provides details on how to configure the properties of the Data Filter component.

Basics

Open the Basics properties on the right and configure the properties described in the following table.

Screenshot

Field

Description

Name

Enter a name for the component.

Data Source

This is the data set on which filtering events act. Data columns from this source populate the Fields section and are available for selection in the drop-down Filter.

Screenshot

Screenshot

Query Model

The query model is built by the filter UI. It does not need to be defined in advance. The following example filter, is represented by the query model shown below.

Screenshot

Query Model

JSON

Copy

{"operator":"AND",
    "children":
        [
            {
                "propertyName": "sym",
                "propertyType":    11,
                "operator":     "equal",
                "value":        "EUR/USD",
                "active":       true
            },
            {
                "propertyName": "src",
                "propertyType": 11,
                "operator":     "not_equal",
                "value":        "BankOnline",
                "active":       true
            },
            { 
                "propertyName": "bid",
                "propertyType": 9,
                "operator":     "greater",
                "value":        "1.3946",
                "active":         true
            },
            {
                "propertyName": "bsize",
                "propertyType": 6,
                "operator":     "less_or_equal",
                "value":        "1000000",
                "active":       true
            }
        ]
}

KDB String

This is the output of the filter and should be assigned to a View State Parameter. The string is then parsed out using a custom Data source in another dashboard component, e.g. a Data Grid.

Screenshot

Screenshot

The KDB String is parsed with the following filteredEvents query, as used in a Data Grid example:

Screenshot

q

Copy
    {[sym;startTime;endTime;filter] 
    res: dfxQuote;

    .dfilt.apply[res;filter]}

Screenshot

Bindings

Bindings allow filter nodes to be assigned to view state parameters. The Bindings available are determined by the view state type. For example, Bindings of type float are available for selection as a filter for float data.

Field

Description

Key

The name of the assigned binding to appear in the drop-down.

Viewstate

The view state parameter used by the filter.

Fields

The default view is text input per the Data source column.

Screenshot

However, a drop-down selector can instead replace the text input. The drop-down can be created using a Data Source or by adding a row. This is done by configuring the Fields properties.

Screenshot

Screenshot

Fields Comparison

Screenshot

Clicking on the Compare Fields icon changes the value input field to a drop-down selector containing a list of all other columns from the data source matching the type of the currently selected column. This makes it possible to do field-to-field comparison when filtering.

Format, Style, Margins

Configure the properties, described in the following table.

Screenshot

Field

Description

Sort List by Selected

When checked and the dropdown is expanded to show the items available for selection, the selected values will be displayed at the top of the list. This property only applies to the values dropdown in a field-to-value comparison.

Remaining fields

Refer to Style for common style settings.

Build a filter

The following example shows a sample key of different Types supported by Data Filter .

Screenshot

Follow these steps to build a filter.

  1. Add a rule.

    Screenshot

    The first dropdown is drawn from the data source data options.

    The second dropdown is one of the operators: equal, not equal, in, not in, like, not like, is blank, is not blank.

  2. Add a second rule. In this case the AND statement requires the first and second rules to be true.

    Screenshot

  3. Add a new Group; show where subType is equal to rejected OR new.

    Screenshot

    This gives a filter result in the Data Grid of:

    Screenshot

    Groups, Rules, and AND/OR statements can be freely mixed and built by the user in the Dashboard.

    Filter group ordering can be changed with drag-and-drop.

Further Reading