How to handle Excel or CSV Drivers
Am using the below code to read the data form .txt file:-
function dbtest(fname)
{
var f1name = "C:\\TestData\\" + fname + ".txt";
// Creates the driver
var Driver2 = DDT["CSVDriver"](f1name);
// Iterates through records
while (! Driver2["EOF"]() )
{
AppScriptDriver();
Driver2["Next"]();
}
// Closing the driver
DDT["CloseDriver"](Driver2["Name"]);
}
function DbMasterBatchController()
{
var Driver1;
// Creates the driver
Driver1 = DDT["CSVDriver"]("C:\\TestData\\MBA.txt");
// Iterates through records
while (! Driver1["EOF"]() )
{
fname = DDT["CurrentDriver"]["Value"](1);
dbtest(fname);
Driver1["Next"]();
}
// Closing the driver
DDT["CloseDriver"](Driver1["Name"]);
Log["Warning"]("Driver closed");
}
while reading the second line in the .txt file (main function) it is giving the error "DDT.CurrentDriver is null or not an object"
If i have only one driver it is working fine. For example if i didn't call the function "dbtest(fname);", all the values in the .txt file is getting displayed.
Please suggest the solution.