Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

XL.Sheet.AutoFilter.SetCustomFilter

Sets the custom filter criteria.

Component Version macOS Windows Linux Server iOS SDK
XL 7.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.Sheet.AutoFilter.SetCustomFilter"; bookRef; sheetIndex; FilterColumnIndex; Operator1; Value1 { ; Operator2; Value2; AndOperator } )   More

Parameters

Parameter Description Example Flags
bookRef The reference to the workbook. Please use XL.LoadBook to load a file. $ref
sheetIndex The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. 0
FilterColumnIndex The column index of the filter.
Range from 0 to XL.Sheet.AutoFilter.ColumnSize-1.
$FilterColumn
Operator1 The operator used by the filter comparison in the first filter criteria.
Can be =, ≠, <, ≤, > or ≥
"="
Value1 value used in the first filter criteria 10
Operator2 The operator used by the filter comparison in the second filter criteria.
Can be =, ≠, <, ≤, > or ≥
"=" Optional
Value2 The value used in the second filter criteria. "20" Optional
AndOperator Flag indicating whether the two criterias have an "and" relationship.
Pass "And" or "Or".
"Or" Optional

Result

Returns OK or error.

Description

Sets the custom filter criteria.
Operator1: operator used by the filter comparison in the first filter criteria;
Value1: value used in the first filter criteria;
Operator2: operator used by the filter comparison in the second filter criteria;
Value2: value used in the second filter criteria;
AndOperator: Flag indicating whether the two criteria have an "and" relationship.

Examples

Sets custom filter:

Set Variable [ $sheet ; Value: 0 ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter"; $book; $sheet ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetRef"; $book; $sheet; 2; 10; 1; 4) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddFilter"; $book; $sheet; 0; "test" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddFilter"; $book; $sheet; 1; "test" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetCustomFilter"; $book; $sheet; 1; "="; 10; "="; "20"; "Or" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.ApplyFilter"; $book; $sheet ) ]

See also

This function checks for a license.

Created 1st July 2017, last changed 3th March 2022


XL.Sheet.AutoFilter.GetTop10 - XL.Sheet.AutoFilter.SetRef