Ask a Question

Read csv using Javascript

SOLVED
Krishna_Kumar
Contributor

Read csv using Javascript

Hi everyone,

 

can any one guide me how to read a csv file using ado connection using javascrip.

 

Regards,

Krishna Kumar

4 REPLIES 4
tristaanogre
Esteemed Contributor

Why do you need to use an ADO connection?  What are you intending to do?  If you're looking at doing a data driven script, simply use the DDT.CSVDriver object.



Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Requirement is to compare the CSV file with the DB values.

So though of using same query to retrieve the data.

 

Regards,

Krishna

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.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

@tristaanogre,

 

Thank you very much for your suggestion,

 

Regards,

Krishna

cancel
Showing results for 
Search instead for 
Did you mean: