DumpToArray
Dumps data from a source, or from the current instance, to an array.
Syntax
expression.DumpToArray(OutPutArray, [DataSource:= Nothing])
Parameters
| Part | Description | 
|---|---|
| OutPutArray | Required. Identifier specifying a dynamic VariantType array variable. | 
| DataSource | Optional. Identifier specifying a CSVArrayListobject variable representing the data to copy from. | 
Returns value
None
📝Note
Before dump data, is required to make a call to the
ImportFromCSVorImportFromCSVstringmethod. The OutPutArray parameter must be declared as dynamicVarianttype array. If user forget to do this, an error can occur.
- See also
- ImportFromCSV method, ImportFromCSVstring method.
Behavior
When the DataSource parameter is omitted the DumpToArray method makes a copy of all data stored in the current instance. If the user specified a data source, its data is copied and returned in the OutPutArray parameter.
⚠️Caution
The data is always returned in a Two-dimensional array, even when the imported file only contain a field per record.
☕Example
Sub DumpToArrray()
    Dim CSVint As CSVinterface
    Dim MyArray() As Variant
    
    Set CSVint = New CSVinterface
    With CSVint.parseConfig
        .path = Environ("USERPROFILE") & "\Desktop\Demo_100000records.csv"
    End With
    With CSVint
        .ImportFromCSV .parseConfig       'Import CSV data
        .DumpToArray MyArray              'Dump the data to an array
    End With
    Erase MyArray
    Set CSVint = Nothing
End Sub