Example 4: Demo Use of DataTable
When we want to approach a file with delimiters as a database, we need to obtain a datatable from the Text Field Parser and put it in the Database Addon.
Since variables are only of the type 'String', we cannot use them for transfer, we have to use the functions in one line.
output = ""
csvFile = "#SCRIPTPATH#\99 TBT Example.csv"
' DBConnectWithDataTable uses a variable with type DataTable,
' while TFPGetDataTable returns a DataTable.
' Since variables are always of the type string (with internal conversion to numbers),
' The use of variables can not be used.
' The functions have to be integrated in one line to use the Datatable type.
Status = DBConnectWithDataTable("TestCSV", TFPGetDataTable(csvFile, true, ""))
' Now convert the datatable to text and format the alignment
Output = DBToText("TestCSV", true)
Output = Tab2Spaces(output, DBGetColumnSize())
Created with the Personal Edition of HelpNDoc: Write eBooks for the Kindle