I'm pretty new to tables/files and I'm simply trying to read a .CSV file, which I found how to read each column and field using the standard example which messageboxes each column then each field. The problem is I don't understand tables that well, so basically I want to import the entire .CSV file into a table dynamically and I can't seem to figure it out. I searched the forums but they all seem to be way beyond where I'm at now.
Like I said I'm able to read each row/column from the .CSV, it's getting the .CSV's contents which are now read into a table dynamically is what I can't figure out. Any help would be appreciated, thanks a lot!
Here is a code sample for a transformation script to illustrate the idea. The Row.Line is the input column that contains an entire line of a text file. This line is taken and split into an array by the comma delimiter. The first time we see the line, it is a header with column names. A boolean flag is used to detect the header condition and we save the column names in a variable. For every subsequent row, we iterate through the column names and match them to an output column that has been defined for the script, assigning the value parsed from the file into the correct column. Using this method, the order of the columns in the text file is irrelevant.
Dim Line AsString = Row.Line
Dim LineTokens AsString() = Line.Split(","c)
If IsHeader Then
HeaderColumns = LineTokens
IsHeader = False
' match input columns to output columns
For i AsInteger = 0 To HeaderColumns.Length - 1
.Time = LineTokens(i)
.Probe1 = LineTokens(i)
.Probe2 = LineTokens(i)
.Probe3 = LineTokens(i)
.Probe4 = LineTokens(i)
For further information, please take a look at the discussion in MSDN forum: