| || |
CSV DDT Driver Question
Is there a way to select one particular row from a CSV file using the CSV DDT Driver.
var sPath = "C:\\QAAutomation\\G\\Downloads\\Site.csv";
The above reads all the rows from the CSV file for Column (6)
Here's my data from the CSV file.
SiteName TotalEnergy AccumulatedDNI DailyAverage PerformanceRatio AvgEnergyPerArray AvailabilityPercentage
MFalls 0 0 0 ** 0 0
F1 373.2 43 5.37 52.2 373.2 95.6
F2 383.1 43 5.37 53.4 383.1 96
Farmer21 518.9 43 5.37 36 259.5 80.8
ISD1 1468.2 45 5.62 28.1 293.6 97.2
I would like to read only the last row from the CSV file.
I'm trying to calculate the above values and get one row from the Database based on a condition.
But the UI report returns a bunch of rows. I would like to compare the last row from CSV file with what is returned by the DB.
Whats the best way to do it?
I'm using JScript ..
Re: CSV DDT Driver Question
DDT reads files row by row. If you want to get a scecific one, iterate through all rows and when the row count reaches the number of the needed one in your file, read its values.
It will be easier in your case to just read your file as a text file and get the last line from it.