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: README.md
+13-16Lines changed: 13 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The most powerful and comprehensive CSV/[TSV](https://www.iana.org/assignments/m
18
18
*__Automatic delimiter sniffer__. Don't worry if you forgot the file configuration. The interface has a solid strategy to sniff delimiters!
19
19
*__Highly Configurable__. User can configure the parser to work with a wide range of CSV files.
20
20
*__CSV data subsetting__. Split CSV data into a set of files with related data.
21
-
*__Like SQL queries on CSV files__. Add your own logic to mimic SQL queries and filter data by criteria (=, <>, >=, <=, AND, OR).
21
+
*__Like SQL queries on CSV files__. Use complex patterns to mimic SQL queries and filter data by criteria (=, <>, >=, <=, & (AND), |(OR)).
22
22
*__Flexible__. Import only certain range of records from the given file, import fields (columns) by indexes or names, read records in sequential mode.
23
23
*__Dynamic Typing support__. Turn CSV data field to a desired VBA data type.
24
24
*__Multi-level data sorting__. Sort CSV imported data over multiple columns using the hyper-fast(100k records per second) [Yaroslavskiy Dual-Pivot Quicksort](https://web.archive.org/web/20151002230717/http://iaroslavski.narod.ru/quicksort/DualPivotQuicksort.pdf) like Java and also other methods like: IntroSort, HeapSort and Merge sort.
@@ -283,26 +283,20 @@ End Sub
283
283
So far, it has been outlined the way in which you can import the records from a CSV file sequentially, the following example shows how to filter the records, in a like SQL way, according to whether they meet a criterion set by the user:
284
284
285
285
```
286
-
Sub QueryCSV(path As String, ByVal keyIndex As Long, queryFilters As Variant)
Copy file name to clipboardExpand all lines: docs/api/csvarraylist.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,11 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
52
52
<tdstyle="text-align: left;">Concatenates the values from the current instance with the specified values and returns a <code>CSVArraylist</code> object as result. The <code>AValues</code> parameter is a <code>Variant</code> data type containing the array, <code>CSVArraylist</code> or value to concatenate.</td>
<tdstyle="text-align: left;">Concatenates the values from the current instance with the specified values and returns a <code>CSVArraylist</code> object as result. The <code>AValues</code> parameter is a <code>CSVArraylist</code> with the values to concatenate.</td>
<tdstyle="text-align: left;">Returns a <code>CSVArraylist</code> object with a copy of the current instance from and to a given index. The <code>StartIndex</code> parameter indicates where the copy will start and the <code>EndIndex</code> determines where the operation will end. If the <code>EndIndex</code> parameter is set to <code>-1</code>, the operation will end at the maximum index available for the current instance.</td>
@@ -72,6 +77,11 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
72
77
<tdstyle="text-align: left;">Creates an empty jagged array. The operation will turns the array <code>ArrVar</code> into an jagged array with <code>ArraySize + 1</code> rows and each row with <code>VectorSize</code> columns. To access to an individual element user must use something like <code>expression(i)(j)</code>, where <code>i</code> denotes an index in the main array and <code>j</code> denotes an index in the child array.</td>
<tdstyle="text-align: left;">[CSV file subset]: The given path name is an empty string or the specified CSV file does not exist in the supplied path.</td>
<tdstyle="text-align: left;">[CSV Field Insert]: Cannot insert a field in the current instance. This is because there is no imported data or the records do not have the same number of fields.</td>
<tdstyle="text-align: left;">Required. Identifier specifying a <code>Long</code> Type variable. Represents the index of the field used for data filtering.</td>
<tdstyle="text-align: left;">Required. Identifier specifying a <code>String</code> Type variable. Represents a valid string expression to evaluate when filtering records</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>String</code> Type variable. Represents the full file path, including file extension, of the CSV file used for data filtering.</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Boolean</code> Type variable. When <code>True</code>, the file headers will be excluded.</td>
40
44
</tr>
41
45
</tbody>
42
46
</table>
@@ -52,42 +56,31 @@ See also
52
56
53
57
## Behavior
54
58
55
-
If the `patterns` parameter is omitted the complete set of stored data will be returned. The rules that apply to the `patterns` parameter are listed below:
56
-
* The 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.
57
-
* The following table describes the special characters to be used when creating patterns; all other characters match themselves:
58
-
*
59
-
|Character|Meaning|
60
-
|:------:|:-----|
61
-
|?|Any single character|
62
-
|\*|Zero or more characters|
63
-
|#|Any single digit (0-9)|
64
-
|\[list\]|Any single character in list|
65
-
|\[!list\]|Any single character not in list|
66
-
|\[\]|A zero-length string ("")|
67
-
* 'list' matches a group of characters in `patterns` to a single character in the string and can contain almost all available characters, including digits.
68
-
* 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\].
69
-
* 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.
70
-
* 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.
71
-
* The exclamation mark outside the bracket matches itself.
72
-
* To use any special character as a matching character, enclose the special character in brackets. For example, to match a question mark, use \[?\].
59
+
The `Pattern` parameter is evaluated according to the number of records in the CSV file, when the evaluation returns `True`, the current record is saved. The rules that apply to the `Pattern` parameter are listed below:
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
+
* 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
+
* 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
+
64
+
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.
<tdstyle="text-align: left;">Required. Identifier specifying a <code>Long</code> Type variable. Represents the index of the field used for data filtering.</td>
If the `patterns` parameter is omitted the complete set of stored data will be returned. The rules that apply to the `patterns` parameter are listed below:
52
+
* The 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.
53
+
* The following table describes the special characters to be used when creating patterns; all other characters match themselves:
54
+
*
55
+
|Character|Meaning|
56
+
|:------:|:-----|
57
+
|?|Any single character|
58
+
|\*|Zero or more characters|
59
+
|#|Any single digit (0-9)|
60
+
|\[list\]|Any single character in list|
61
+
|\[!list\]|Any single character not in list|
62
+
|\[\]|A zero-length string ("")|
63
+
* 'list' matches a group of characters in `patterns` to a single character in the string and can contain almost all available characters, including digits.
64
+
* 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\].
65
+
* 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.
66
+
* 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.
67
+
* The exclamation mark outside the bracket matches itself.
68
+
* To use any special character as a matching character, enclose the special character in brackets. For example, to match a question mark, use \[?\].
0 commit comments