Numeric Range Filters

This type of filters can be used to allow the user to filter data where an attribute’s value lies within a minimum and a maximum value.

The developer can choose how the user will select the minimum and maximum values. The available options are:

  1. Dynamic Range Set: The user can select a value from a set of predefined options, loaded from a DataProvider. The developer can define the data provider to suit the application’s needs.

  2. Manual (fields): The user can input the minimum and maximum values manually in the UI using two input fields.

  3. Manual (slider): The user can select the minimum and maximum values manually using a slider.

To use this type of filter the Type property must be set to “NumericRange”. The “Numeric Range Type” and “Manual Input Type” properties can be used to select from the options shown above.

Using Range Type = Dynamic Range Set

When this option is used, a combobox to select the range will be shown.

NumericRangeFilterDynamicSample
Range Type = Dynamic Range Set sample

A Data Provider must be defined in order to use this option. The data Provider must have no input parameters, and its output type must be K2BNumericRangeSet.

K2BNumericRangeSet
Numeric Range Set SDT

The SDT fields are:

  1. Code: Used to identify each option within the collection. When using the “Save Grid State” feature this value should stay constant across versions as much as possible, to ensure that the saved values are consistent.

  2. Description: A user friendly value shown to the user when selecting the option.

  3. FromValue: The value used as the minimum for the range.

  4. ToValue: The value used as the maximum for the range.

The FromValue/ToValue fields are defined with a Character type to support all sizes and decimal places possible. When developing the data provider, the corresponding character representations must be used. When the filter is used, K2BTools will load the value using the “FromString” method.

K2BTools provides a sample Data Provider called “K2BToolsNumericRangeProviderSample” that the developer can copy to create data providers specific to each situation.

NumericRangeSetProviderSample
Numeric Range Set Provider sample

The range selection list can be customized using the "Range Selector Control" property. Possible options are "Combo" (as in the previous samples) or "List", as shown below:

NumericRangeSelectorControlList
Numeric Range Selector Control List

Using Range Type = Manual

In this case, the developer can choose the Default From / Default To values to define the filter’s initial values.

NumericRangeFilterManualSample
Range Type = Manual sample

Using Input Type = Slider

In this case, the Default From / Default To values cannot be empty.

NumericRangeFilterSliderSample
Range Type = Slider sample

In order to use this control, the following values must also be set:

  1. Slider Minimum / Slider Maximum: The bounds of the control

  2. Slider Step: The minimum increment between consecutive values that the user can choose.