You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/methods/filter.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,22 @@ The `Pattern` parameter is evaluated according to the number of records in the C
60
60
* To reference a field value, the user must type something like `f#` where `f` is a required identifier and `#` is the numeric position of the desired field. For example, `f1>5` indicates the selection of records whose first field value is greater than `5`.
61
61
* If the user needs to compare literal strings, the values must be enclosed in apostrophes. Example, `Region = 'Central America'` is a valid string assigned to the variable `Region`.
62
62
* User can use functions in the `Pattern` definition, including custom UDFs (refer to [VBAexpressions documentation](https://github.com/ws-garcia/VBA-Expressions)). I.e.: `min(f5;f2)>=100`
63
+
* The LIKE operator (`$`) comparison is influenced by the `Option Compare` statement (one of: `Option Compare Binary` or `Option Compare Text`). The binary compare is case sensitive, the text compare is not. The following table describes the special characters to be used when creating patterns; all other characters match themselves:
64
+
*
65
+
|Character|Meaning|
66
+
|:------:|:-----|
67
+
|?|Any single character|
68
+
|\*|Zero or more characters|
69
+
|#|Any single digit (0-9)|
70
+
|\[list\]|Any single character in list|
71
+
|\[!list\]|Any single character not in list|
72
+
|\[\]|A zero-length string ("")|
73
+
* 'list' matches a group of characters in `patterns` to a single character in the string and can contain almost all available characters, including digits.
74
+
* Use a hyphen (-) in 'list' to create a range of characters that matches a character in the string: e.g. [A-D] matches A,B,C, or D at that character position in the string. Multiple ranges of characters can be included in 'list' without the use of a delimiter: e.g. \[A-DJ-L\].
75
+
* Use the hyphen at the start or end of 'list' to match to itself. For example, \[-A-G\] matches a hyphen or any character from A to G.
76
+
* The exclamation mark in the "pattern" match is similar to the negation operator. For example, [!A-G] matches all characters except characters A through G.
77
+
* The exclamation mark outside the bracket matches itself.
78
+
* To use any special character as a matching character, enclose the special character in brackets. For example, to match a question mark, use \[?\].
63
79
64
80
When the `FilePath` argument is omitted, the method will proceed to filter the data stored in the current instance, otherwise it will filter the content of the CSV file specified with the referred argument.
65
81
@@ -76,8 +92,8 @@ Sub FilterCSV()
76
92
CSVint.parseConfig.Headers=False'The file has no header record/row
77
93
CSVint.parseConfig.path=path
78
94
Ifpath<>vbNullStringThen
79
-
SetFilteredData=CSVint.Filter("f1='Asia' & f9>20 & f9<=50",path)'Select "Units sold" greater than 20 and less or
80
-
'equal to 50 from Asian customers
95
+
SetFilteredData=CSVint.Filter("f1='Asia' & f9>20 & f9<=50 & f8 $ '10/*/2014'",path)'Select "Units sold" greater than 20 and less or
0 commit comments