CSVArrayList
Class module developed to emulate some functionalities from the ArrayList
present in some most modern languages. The CSVArrayList
serves as a container for all the data read from CSV files and can be used to manipulate the stored items, or to store data that does not come from a CSV file, according to the user’s request.
Members
Item | Type | Description |
---|---|---|
Add | Method | Appends a copy of the specified value to the current instance. Given the nature adopted by the CSV interface to store data, if the value to be appended to the current instance is not a one-dimensional array, where each element represents a field, the user will not be able to use data sorting methods properly. User must use the Add2 method instead if the goal is to sort stored items. |
Add2 | Method | Appends a copy of the specified values to the current instance. In contrast to the Add method, the data is operated on before being stored, so if the values to be appended to the current instance are not one-dimensional arrays, they will be properly stored as one-dimensional array. In this way, the user will be able to use the data sorting methods provided by the class as long as no multi-dimensional arrays are stored in the current instance. |
AddIndexedItem | Method | Appends a copy of the specified values to the current instance using a string-type key. This allows access to the elements by providing an index or a key. If the key exist, the item will be modified only if the UpdateExistingItems parameter is ser to True . |
Clear | Method | Reinitializes the current instance. |
Clone | Method | Returns a CSVArraylist as a exact copy of the current instance. |
Concat | Method | Concatenates the values from the current instance with the specified values and returns a CSVArraylist object as result. The AValues parameter is a Variant data type containing the array, CSVArraylist or value to concatenate. |
Concat2 | Method | Concatenates the values from the current instance with the specified values and returns a CSVArraylist object as result. The AValues parameter is a CSVArraylist with the values to concatenate. |
Copy | Method | Returns a CSVArraylist object with a copy of the current instance from and to a given index. The StartIndex parameter indicates where the copy will start and the EndIndex determines where the operation will end. If the EndIndex parameter is set to -1 , the operation will end at the maximum index available for the current instance. |
CopyToArray | Method | Returns an array with a copy of the current instance from and to a given index. The StartIndex parameter indicates where the copy will start and the EndIndex determines where the operation will end. If the EndIndex parameter is set to -1 , the operation will end at the maximum index available for the current instance. |
count | Property | Returns the amount of items stored in the current instance. |
CreateJagged | Method | Creates an empty jagged array. The operation will turns the array ArrVar into an jagged array with ArraySize + 1 rows and each row with VectorSize columns. To access to an individual element user must use something like expression(i)(j) , where i denotes an index in the main array and j denotes an index in the child array. |
Dedupe | Method | Remove duplicates from records. Requires rectangular table input (all records with same fields count).The keys 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. |
Filter | Method | Returns a filtered array list using the CSVexpressions class module. |
FromString | Method | Main constructor method. Populates the current instance using values passed as a Java array string (\{\{*\};\{*\}\} ). |
GetIndexedItem | Method | Gets an indexed Item, by its key, from the current instance. |
Group | Method | Groups rows having the same values into a summary. |
IndexedItems | Property | Gets all indexed Items from the current instance. |
indexing | Property | Indicates whether the current instance is used to store indexed elements. |
Inner, Left and Right Join | Method | Run a like SQL join on the provided data tables. 1) Use a string such as {1-2,5,ID};{1-6} 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.2) Use a string such as {*};{1-3} to indicate the union of ALL columns of leftTable with columns 1 to 3 of rightTable.3) The predicate must use the dot syntax [t1.#][t1.fieldName] to indicate the fields of the table, where t1 refers to the leftTable.4) The matchKeys predicate must be given as #/$;#/$ . |
Insert | Method | Inserts an Item, at the given Index, in the current instance of the class. |
InsertField | Method | Inserts a new field named FieldName 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. |
IsJaggedArray | Method | Returns True if the paseed argument is a jagged array. |
isSorted | Property | Returns True if the current instance data is sorted. |
item | Property | 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 expression(i) to access the Item i , where expression represents a CSVArrayList object. |
ItemExist | Method | Checks if a given field exists in a record of the current instance. Returns False when the key can not be found. |
ItemIndex | Method | Performs a search, on a given field, and retrieves the index of the target record. USE ONLY WITH SORTED DATA. |
ItemKey | Method | Gets the key at given position. |
items | Property | Gets or sets the collection of elements from or to the current instance. To set the elements, the AValue parameter must be an array. |
JaggedToTwoDimArray | Method | Turns a jagged array into a two dim array. The method will successively deconstruct and delete the jagged array, passing its contents to the specified two-dimensional array. |
KeyExist | Method | Searches for a key in the internal indexed records and returns True when found. |
KeyIndex | Method | Searches for an element in the internal indexed records, using a key, in the current instance (ONLY when the data is already sorted in ascending order). Returns the index of the element when found and -1 when the key is not found. |
Keys | Property | Gets all keys for all indexed Items from the current instance. |
keyTree | Property | Allows to store and group elements with the same key. |
lastSortedIndex | Property | Retrieves the index of the field used in the last sort operation. |
MergeFields | Method | Merges the specified fields in the current instance data table. The indexes 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. |
MultiDimensional | Method | Checks if an array has more than one dimension and returns True or False . |
RearrangeFields | Method | 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. |
Reduce | Method | Reduces the internal array list to the result by evaluate the ReductionExpression parameter over all items. |
Reinitialize | Method | Reinitializes the current instance of the class and reserves the storage space desired by the user through the bufferSize parameter. |
RemoveAt | Method | Removes the Item at specified Index. |
RemoveField | Method | Removes the field at specified aIndex in all records. |
RemoveIndexedItem | Method | Removes an indexed Item using the specified key. |
RemoveRange | Method | Removes a range of Items starting at the specified Index. |
Reverse | Method | Reverse the order of the internal items, from a given StartIndex to a EndIndex . |
Reverse2 | Method | Reverse the order in the target jagged array, from a given StartIndex to a EndIndex . |
ShiftField | Method | Moves a field leftward or rightward. Negative values for the Shift argument will produce leftward shifts. |
ShiftRecord | Method | Moves a record upward or downward. Negative values for the Shift argument will produce upward shifts. |
ShrinkBuffer | Method | Shrinks the buffer size to avoid extra space reservation. |
Sort | Method | Sorts the internal Items. Requires all Items to be one-dimensional arrays. If the FromIndex is set to -1 , the sorting will start at the Items lower bound; when the ToIndex is set to -1 , the operation will end at the Items upper bound. The SortingKeys 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 SortAlgorithm parameter indicates which sort algorithm will be used to perform the sort. |
SortByField | Method | Sorts the internal items by an specified field. |
SortKeys | Method | Sorts the internal Items by its keys using QuickSort. Requires all Items to be one-dimensional arrays. The indexes are base 0. |
SplitField | Method | Splits the specified field in the current instance data table. |
Swap | Method | Swap Items in buffer. |
Swap2 | Method | Swap Items in target jagged array. |
ToString | Method | Serializes the buffer contents to a common string representation. Only one-dimensional arrays and jagged arrays populated with one-dimensional arrays are supported. |
TwoDimToJaggedArray | Method | 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. |