.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

AutoFilterColumn.ApplyCustomFilter(FilterValue, FilterComparisonOperator, FilterValue, FilterComparisonOperator, Boolean) Method

Applies a custom filter based on the compound filter expression.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v21.1.Core.dll

Declaration

void ApplyCustomFilter(
    FilterValue firstCriteria,
    FilterComparisonOperator firstCriteriaOperator,
    FilterValue secondCriteria,
    FilterComparisonOperator secondCriteriaOperator,
    bool criterionAnd
)

Parameters

Name Type Description
firstCriteria FilterValue

A FilterValue object that specifies the first filter criterion value.

firstCriteriaOperator FilterComparisonOperator

A FilterComparisonOperator enumeration member that defines the comparison operator for the first filter criterion.

secondCriteria FilterValue

A FilterValue object that specifies the second filter criterion value.

secondCriteriaOperator FilterComparisonOperator

A FilterComparisonOperator enumeration member that defines the comparison operator for the second filter criterion.

criterionAnd Boolean

A Boolean value indicating whether the logical operator "AND" should be used to combine two filter criteria. If false, the "OR" operator is used.

Remarks

Use the ApplyCustomFilter method to filter values by two criteria, as illustrated in the example below.

' Enable filtering for the specified cell range.
Dim range As CellRange = worksheet("B2:E23")
worksheet.AutoFilter.Apply(range)

' Filter values in the "Sales" column that are in a range from 5000$ to 8000$.
Dim sales As AutoFilterColumn = worksheet.AutoFilter.Columns(2)
sales.ApplyCustomFilter(5000, FilterComparisonOperator.GreaterThanOrEqual, 8000, FilterComparisonOperator.LessThanOrEqual, True)

You can also use wildcards and the FilterValue.FilterByBlank value to perform more versatile filtering.

' Enable filtering for the specified cell range.
Dim range As CellRange = worksheet("B2:E23")
worksheet.AutoFilter.Apply(range)

' Filter values in the "Product" column that contain "Gi" and include empty cells.
Dim products As AutoFilterColumn = worksheet.AutoFilter.Columns(1)
products.ApplyCustomFilter("*Gi*", FilterComparisonOperator.Equal, FilterValue.FilterByBlank, FilterComparisonOperator.Equal, False)
See Also