AutoFilter

An AutoFilter allows users to filter a Deephaven table based on an automatically generated list of unique values found in the column. This feature is enabled for columns through the query used to create the table by applying the .layoutHints method with an autofilter argument. The syntax follows:

.layoutHints(LayoutHintBuilder.get().autoFilter("ColumnA","ColumnB","ColumnC"))

Note: The columns named in the argument must be separated with commas only, with no extra spaces.

Example

from deephaven import *

t1=db.t("LearnDeephaven", "StockTrades").where("Date=`2017-08-21`")\
    .layoutHints(LayoutHintBuilder.get().autoFilter("USym", "Exchange", "Size"))
import com.illumon.iris.db.tables.utils.LayoutHintBuilder
t1=db.t("LearnDeephaven", "StockTrades").where("Date=`2017-08-21`")
        .layoutHints(LayoutHintBuilder.get().autoFilter("USym","Exchange","Size"))

This query generates the t1 table using data from the StockTrades table in the LearnDeephaven namespace, filters the data to show only data from August 21, 2017, applies the layoutHints method, and then creates an AutoFilter for the USym, Exchange, and Size columns.

Once the layout hints have been applied, a filter icon will appear () when the cursor is hovered over the column heading, as shown in the screenshot below:

Clicking on the empty funnel icon will change the icon to a filled  funnel ()  and will open a pop-up menu that contains a searchable list of the unique items in that column.  Note:  If the table is large, the pop-up may take longer to load, and a progress bar will appear to indicate its status. Because the menu is a pop-up (rather than a dialog window), clicking anywhere else in the console will dismiss the filter and cancel the data load.

By default, the dialog will return up to 1,000 unique values from the column. In this case, there are only nine unique values in the Exchange column to display.

If the column contained more than 1,000 unique values (such as Size), a More Data button would appear. When selected, the menu could then return up to 1 million unique items. 

The Search field at the top may also be used to filter the list, which is particularly useful when you have a large number of items.

To filter the table, select the items from the pop-up menu and click OK.  The table will then be filtered to show only those rows that contain the selected items in that column. The header of the column turns blue to indicate a filter has been applied.

For example, the StockTrades table pictured below has been filtered to show only rows with either "Nasdaq" or "Nyse" in the Exchange column.

To clear any AutoFilter(s), right-click in the column header and select Clear Filter or Clear All Filters from the drop-down menu.

Optional Properties

As stated above, the default initial fetch size for the AutoFilter dialog is 1,000 unique items. This can be changed globally by modifying the property:

AutoFilterSelectionPanel.defaultInitialFetchSize=[size]

You can also set the maximum fetch size by modifying the property:

AutoFilterSelectionPanel.maxAutoFilterItems=[size]

The fetch size can be set per-column by including this method in your layout builder:

.autoFilterFetchSize("ColName", int size)

Additionally, modifying the maximum cache size property will keep selected values in the cache so that they always appear in the AutoFilter dialog regardless of the fetch size.

AutoFilterSelectionPanel.maxCacheSize=[size]

This property defaults to 100. Cached items appear first (even after they become unselected).

These should be configured in the iris_console and interactive_console stanza.


Last Updated: 16 February 2021 18:07 -04:00 UTC    Deephaven v.1.20200928  (See other versions)

Deephaven Documentation     Copyright 2016-2020  Deephaven Data Labs, LLC     All Rights Reserved