Page 1 of 1

Writing a TVirtualTable to a CSV file

Posted: Thu 21 Jul 2016 16:03
by sde
Hi,

I have an application that creates very large datasets (e.g., 700,000 records). I'm creating and storing the data in a TVirtualTable, but then I need to output this to a CSV file. The way I attempted to do this was go through each record in the table, convert it to a comma separated string and add it to a TStringList so I could use the TStringList.SaveToStream method to efficiently write to a file. The problem I'm running into is that I run out of memory trying to populate the TStringlist. Do you have any suggestions for a better way to go from a TVirtualTable to a CSV?

Thanks!
SDE

Re: Writing a TVirtualTable to a CSV file

Posted: Wed 03 Aug 2016 09:04
by MaximG
The TVirtualTable component allows to save data in XML format compatible with ADO (https://www.devart.com/unidac/docs/?dev ... etoxml.htm) and in its own Virtual Table Data format (*.vtd) using the SaveToFile method. Working with both formats is shown in the Demo, that is distributed with VirtualDAC. Data saving to other formats should be implemented by you on demand.

Re: Writing a TVirtualTable to a CSV file

Posted: Wed 03 Aug 2016 13:10
by avelivelo
When the Tvirtualtable saves the data in adoxml using savetoxml, is it possible to easily convert the adoxml to UTF-8 xml format?
Thank you so much!

Re: Writing a TVirtualTable to a CSV file

Posted: Thu 04 Aug 2016 08:46
by MaximG
Unfortunately, TVirtualTable doesn't support saving in XML UTF-8 format .Our components are designed mainly to provide access to data. Therefore data saving is implemented either for internal use (Virtual Table Data format *.vtd) or in ADO XML format.