Skip to content

Commit bde84c0

Browse files
committed
VBA CSV Interface v4.3.0
1 parent 9b2f972 commit bde84c0

File tree

10 files changed

+4265
-1157
lines changed

10 files changed

+4265
-1157
lines changed

docs/api/csvarraylist.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,21 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
7979
<td style="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>
8080
</tr>
8181
<tr>
82+
<td style="text-align: left; color:blue;"><em>Dedupe</em></td>
83+
<td style="text-align: left;">Method</td>
84+
<td style="text-align: left;">Remove duplicates from records. Requires rectangular table input (all records with same fields count).The <code>keys</code> parameter will indicate which fields/columns will be used in the deduplication. A string like "0,5" used as parameter will deduplicate the records over columns 0 and 5. If a string like "1-6" is used as argument, the deduplication will use the 2nd through 7th fields.</td>
85+
</tr>
86+
<tr>
8287
<td style="text-align: left; color:blue;"><em>Filter</em></td>
8388
<td style="text-align: left;">Method</td>
8489
<td style="text-align: left;">Returns a filtered array list using the <code>CSVexpressions</code> class module.</td>
8590
</tr>
8691
<tr>
92+
<td style="text-align: left; color:blue;"><em>FromString</em></td>
93+
<td style="text-align: left;">Method</td>
94+
<td style="text-align: left;">Main constructor method. Populates the current instance using values passed as a Java array string (<code>{{*};{*}}</code>).</td>
95+
</tr>
96+
<tr>
8797
<td style="text-align: left; color:blue;"><em>GetIndexedItem</em></td>
8898
<td style="text-align: left;">Method</td>
8999
<td style="text-align: left;">Gets an indexed Item, by its key, from the current instance.</td>
@@ -99,26 +109,36 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
99109
<td style="text-align: left;">Gets all indexed Items from the current instance.</td>
100110
</tr>
101111
<tr>
102-
<td style="text-align: left; color:blue;"><em>Indexing</em></td>
112+
<td style="text-align: left; color:blue;"><em>indexing</em></td>
103113
<td style="text-align: left;">Property</td>
104114
<td style="text-align: left;">Indicates whether the current instance is used to store indexed elements.</td>
105115
</tr>
106116
<tr>
107117
<td style="text-align: left; color:blue;"><em>Inner, Left and Right Join</em></td>
108118
<td style="text-align: left;">Method</td>
109-
<td style="text-align: left;">Run a like SQL join on the provided data tables.<br>1) Use a string such as <code>{1-2,5,ID};{1-6}</code> as a predicate of the columns to indicate the join of columns 1 to 2, 5 and ID of leftTable with the columns 1 to 6 of rightTable.<br>2) Use a string such as <code>{*};{1-3}</code> to indicate the union of ALL columns of leftTable with columns 1 to 3 of rightTable.<br>3) The predicate must use the dot syntax <code>[t1.#][t1.fieldName]</code> to indicate the fields of the table, where t1 refers to the leftTable.<br>4) The matchKeys predicate must be given as <code>#/$;#/$</code></td>
119+
<td style="text-align: left;">Run a like SQL join on the provided data tables.<br>1) Use a string such as <code>{1-2,5,ID};{1-6}</code> as a predicate of the columns to indicate the join of columns 1 to 2, 5 and ID of leftTable with the columns 1 to 6 of rightTable.<br>2) Use a string such as <code>{*};{1-3}</code> to indicate the union of ALL columns of leftTable with columns 1 to 3 of rightTable.<br>3) The predicate must use the dot syntax <code>[t1.#][t1.fieldName]</code> to indicate the fields of the table, where t1 refers to the leftTable.<br>4) The matchKeys predicate must be given as <code>#/$;#/$</code>.</td>
110120
</tr>
111121
<tr>
112122
<td style="text-align: left; color:blue;"><em>Insert</em></td>
113123
<td style="text-align: left;">Method</td>
114124
<td style="text-align: left;">Inserts an Item, at the given Index, in the current instance of the class.</td>
115125
</tr>
116126
<tr>
127+
<td style="text-align: left; color:blue;"><em>InsertField</em></td>
128+
<td style="text-align: left;">Method</td>
129+
<td style="text-align: left;">Inserts a new field named <code>FieldName</code> into the records of the current instance at the given index. If a formula is provided, the field is populated in each record (row) with the result of evaluating the formula using the fields specified in the formula.</td>
130+
</tr>
131+
<tr>
117132
<td style="text-align: left; color:blue;"><em>IsJaggedArray</em></td>
118133
<td style="text-align: left;">Method</td>
119134
<td style="text-align: left;">Returns <code>True</code> if the paseed argument is a jagged array.</td>
120135
</tr>
121136
<tr>
137+
<td style="text-align: left; color:blue;"><em>isSorted</em></td>
138+
<td style="text-align: left;">Property</td>
139+
<td style="text-align: left;">Returns <code>True</code> if the current instance data is sorted.</td>
140+
</tr>
141+
<tr>
122142
<td style="text-align: left; color:blue;"><em>item</em></td>
123143
<td style="text-align: left;">Property</td>
124144
<td style="text-align: left;">Gets or sets an Item, by its index, from the current instance. This is the default property, so the user can use abbreviated expressions such as <code>expression(i)</code> to access the Item <code>i</code>, where <code>expression</code> represents a <code>CSVArrayList</code> object.</td>
@@ -164,11 +184,31 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
164184
<td style="text-align: left;">Gets all indexed Items from the current instance.</td>
165185
</tr>
166186
<tr>
187+
<td style="text-align: left; color:blue;"><em>keyTree</em></td>
188+
<td style="text-align: left;">Property</td>
189+
<td style="text-align: left;">Allows to store and group elements with the same key.</td>
190+
</tr>
191+
<tr>
192+
<td style="text-align: left; color:blue;"><em>lastSortedIndex</em></td>
193+
<td style="text-align: left;">Property</td>
194+
<td style="text-align: left;">Retrieves the index of the field used in the last sort operation.</td>
195+
</tr>
196+
<tr>
197+
<td style="text-align: left; color:blue;"><em>MergeFields</em></td>
198+
<td style="text-align: left;">Method</td>
199+
<td style="text-align: left;">Merges the specified fields in the current instance data table. The <code>indexes</code> parameter will indicate which fields/columns will be merged. A string like "2,7" used as parameter will merge the records over the columns with indexes 2 and 7. If a string like "3-8,10" is used as argument, the merge operation will use the 4th to 9th fields and the 11th field.</td>
200+
</tr>
201+
<tr>
167202
<td style="text-align: left; color:blue;"><em>MultiDimensional</em></td>
168203
<td style="text-align: left;">Method</td>
169204
<td style="text-align: left;">Checks if an array has more than one dimension and returns <code>True</code> or <code>False</code>.</td>
170205
</tr>
171206
<tr>
207+
<td style="text-align: left; color:blue;"><em>RearrangeFields</em></td>
208+
<td style="text-align: left;">Method</td>
209+
<td style="text-align: left;">Rearranges the fields of the stored data. A string such as "0-3,5-4,6-11" used as a parameter will leave the position of fields with indexes 0 to 3 unchanged, swap the fields at indexes 5 and 4, and leave all remaining fields in position.</td>
210+
</tr>
211+
<tr>
172212
<td style="text-align: left; color:blue;"><em>Reduce</em></td>
173213
<td style="text-align: left;">Method</td>
174214
<td style="text-align: left;">Reduces the internal array list to the result by evaluate the <code>ReductionExpression</code> parameter over all items.</td>
@@ -184,6 +224,11 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
184224
<td style="text-align: left;">Removes the Item at specified Index.</td>
185225
</tr>
186226
<tr>
227+
<td style="text-align: left; color:blue;"><em>RemoveField</em></td>
228+
<td style="text-align: left;">Method</td>
229+
<td style="text-align: left;">Removes the field at specified <code>aIndex</code> in all records.</td>
230+
</tr>
231+
<tr>
187232
<td style="text-align: left; color:blue;"><em>RemoveIndexedItem</em></td>
188233
<td style="text-align: left;">Method</td>
189234
<td style="text-align: left;">Removes an indexed Item using the specified key.</td>
@@ -204,6 +249,16 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
204249
<td style="text-align: left;">Reverse the order in the target jagged array, from a given <code>StartIndex</code> to a <code>EndIndex</code>.</td>
205250
</tr>
206251
<tr>
252+
<td style="text-align: left; color:blue;"><em>ShiftField</em></td>
253+
<td style="text-align: left;">Method</td>
254+
<td style="text-align: left;">Moves a field leftward or rightward. Negative values for the <code>Shift</code> argument will produce leftward shifts.</td>
255+
</tr>
256+
<tr>
257+
<td style="text-align: left; color:blue;"><em>ShiftRecord</em></td>
258+
<td style="text-align: left;">Method</td>
259+
<td style="text-align: left;">Moves a record upward or downward. Negative values for the <code>Shift</code> argument will produce upward shifts.</td>
260+
</tr>
261+
<tr>
207262
<td style="text-align: left; color:blue;"><em>ShrinkBuffer</em></td>
208263
<td style="text-align: left;">Method</td>
209264
<td style="text-align: left;">Shrinks the buffer size to avoid extra space reservation.</td>
@@ -214,6 +269,21 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
214269
<td style="text-align: left;">Sorts the internal Items. Requires all Items to be one-dimensional arrays. If the <code>FromIndex</code> is set to <code>-1</code>, the sorting will start at the Items lower bound; when the <code>ToIndex</code> is set to <code>-1</code>, the operation will end at the Items upper bound. The <code>SortingKeys</code> parameter is used to define the index of the columns on which the sorting operation will be performed, negative values indicate sorting in descending order; the user can pass an array of sorting keys as a parameter. The <code>SortAlgorithm</code> parameter indicates which sort algorithm will be used to perform the sort.</td>
215270
</tr>
216271
<tr>
272+
<td style="text-align: left; color:blue;"><em>SortByField</em></td>
273+
<td style="text-align: left;">Method</td>
274+
<td style="text-align: left;">Sorts the internal items by an specified field.</td>
275+
</tr>
276+
<tr>
277+
<td style="text-align: left; color:blue;"><em>SortKeys</em></td>
278+
<td style="text-align: left;">Method</td>
279+
<td style="text-align: left;">Sorts the internal Items by its keys using QuickSort. Requires all Items to be one-dimensional arrays. The indexes are base 0.</td>
280+
</tr>
281+
<tr>
282+
<td style="text-align: left; color:blue;"><em>SplitField</em></td>
283+
<td style="text-align: left;">Method</td>
284+
<td style="text-align: left;">Splits the specified field in the current instance data table.</td>
285+
</tr>
286+
<tr>
217287
<td style="text-align: left; color:blue;"><em>Swap</em></td>
218288
<td style="text-align: left;">Method</td>
219289
<td style="text-align: left;">Swap Items in buffer.</td>
@@ -224,6 +294,11 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
224294
<td style="text-align: left;">Swap Items in target jagged array.</td>
225295
</tr>
226296
<tr>
297+
<td style="text-align: left; color:blue;"><em>ToString</em></td>
298+
<td style="text-align: left;">Method</td>
299+
<td style="text-align: left;">Serializes the buffer contents to a common string representation. Only one-dimensional arrays and jagged arrays populated with one-dimensional arrays are supported.</td>
300+
</tr>
301+
<tr>
227302
<td style="text-align: left; color:blue;"><em>TwoDimToJaggedArray</em></td>
228303
<td style="text-align: left;">Method</td>
229304
<td style="text-align: left;">Turns a two-dimensional array into a jagged array. The method will successively deconstruct and delete the two-dimensional, passing its contents to the specified jagged array array.</td>

docs/api/methods/insertfield.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Inserts a new field, at the specified position, in the imported CSV data.
3535
<td style="text-align: left;"><em>FieldName</em></td>
3636
<td style="text-align: left;">Optional. Identifier specifying a <code>String</code> Type variable representing the name of the new field.</td>
3737
</tr>
38+
<tr>
39+
<td style="text-align: left;"><em>Formula</em></td>
40+
<td style="text-align: left;">Optional. Identifier specifying a <code>String</code> Type variable representing the expression used to compute the value for the new field.</td>
41+
</tr>
3842
</tbody>
3943
</table>
4044

@@ -49,7 +53,7 @@ See also
4953

5054
## Behavior
5155

52-
The `InsertField` method will insert a new field into all records, if they all have the same number of fields, in the current instance. The value of the `FieldName` parameter will be inserted into the record/first row, otherwise not.
56+
The `InsertField` method will insert a new field into all records, if they all have the same number of fields, in the current instance. The value of the `FieldName` parameter will be inserted into the record/first row, otherwise not. If a formula is given, the field is populated in each record (row) with the result of evaluating the formula on each field.
5357

5458
### ☕Example
5559

@@ -64,7 +68,8 @@ Sub InsertField()
6468
End With
6569
With CSVint
6670
.ImportFromCSV .parseConfig
67-
.InsertField .fieldsBound + 1, "New field" 'Insert a field named "New field"
71+
.InsertField .fieldsBound + 1, "Taxes" , "FORMAT(Total Revenue * Percent(18);'Currency')") 'Insert a field named "Taxes"
72+
'and use a custom fomula for compute it.
6873
End With
6974
Set CSVint = Nothing
7075
End Sub

src/Access_version.zip

-2.48 KB
Binary file not shown.

0 commit comments

Comments
 (0)