Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
Doubt 1 - Where do I find this DDT.CurrentDriver? In my case, DDT.ExcelDriver (I guess).
DDT.CurrentDriver returns the last DDT driver that was created. So, if you do this:
var Driver1 = DDT.CSVDriver("C:\\Temp\\Test.CSV")
var Driver2 = DDT.ExcelDriver("C:\\Temp\\Test.XLS", "Sheet1", true)
var Driver3 = DDT.CurrentDriver()
Driver3 then returns the ExcelDriver because it was the last driver created. See http://smartbear.com/support/viewarticle/13851/
Doubt 2 - The example of how to use DDT.ExcelDriver isn't very clear. It shows how to import the sheet, but how will I set values from Column 1 to one TextBox?
function CurDriverExample()
{
// Creates a driver
DDT.ExcelDriver("C:\\MyFile.xls", "Sheet1");
// Iterates through records
while (! DDT.CurrentDriver.EOF)
//...
Aliases.MyApp.MyForm.MyTextBox.Text = DDT.CurrentDriver.Value("MyTextData")
DDT.CurrentDriver.Next();
// Closes the driver
DDT.CloseDriver(DDT.CurrentDriver.Name);
}
Essentially, each column in the DDT driver is referenced by the Value property which you can then utilize in any way you may need to, either to populate data on a form, to use to check values on a form, to evaluate into a function to be executed, etc. There's a tutorial on doing so in scripts found at
http://smartbear.com/support/viewarticle/11891/