Read csv using Javascript
- 6 years ago
I wouldn't ready the file via an SQL query. I've done this in the past. Use aqFile.OpenTextFile (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqfile/opentextfile.html) to open the file for reading. Then simply use the ReadLine method to read each line of the file in as you loop through the record set from your DB query. You can then use, for the line itself, the aqString.GetListItem(https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/getlistitem.html) and other supporting methods to get the particular fields out of the line of the CSV file.
Alternatively... you could still use DDT.CSVDriver to open the CSV file and then, within a loop based upon the resulting DDT object, compare fields and rows as you loop through.