AutoFilterColumn.ApplyCustomFilter(FilterValue, FilterComparisonOperator, FilterValue, FilterComparisonOperator, Boolean) Method
Applies a custom filter based on the compound filter expression.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v20.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
NuGet Packages: DevExpress.Spreadsheet.Core, DevExpress.WindowsDesktop.Spreadsheet.Core
Declaration
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)
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ApplyCustomFilter(FilterValue, FilterComparisonOperator, FilterValue, FilterComparisonOperator, Boolean) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.