Ask a Question

issue with DDT driver method

SOLVED
salley
Frequent Contributor

issue with DDT driver method

Hi,

i'm trying to iterate through data, and when there's no more data it's throwing a VBScript runtime error saying Invalid use of Null: 

** any help would be highly appreciated

Below is my code

 

Function ReadInputFile(filename)
Path = ProjectSuite.Path
ReadInputFile = path+"TestData\"+filename+".xlsx"
End Function
Sub ReadConfigData
Dim Driver
aqutils.Delay(600)
excelpath = ReadInputFile("NYTestData")
Set Driver = DDT.ExcelDriver(excelpath,"TestData",True)
While Not DDT.CurrentDriver.EOF
strExeIndicator=Trim(DDT.CurrentDriver.Value("Run"))
TestID=Trim(DDT.CurrentDriver.Value("TestID"))
msgbox strExeIndicator
msgbox TestID
DDT.CurrentDriver.Next()
Wend
'Set Driver = Nothing
DDT.CloseDriver(DDT.CurrentDriver.Name)
End Sub

6 REPLIES 6
tristaanogre
Esteemed Contributor

On what line do you get that error?

 

I've seen that problem in my code if, for some reason, I have an empty row in my excel sheet added to the end... double check and make sure that you have no active rows at the end of your sheet that are empty.


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
salley
Frequent Contributor

hi,

on line "strExeIndicator=Trim(DDT.CurrentDriver.Value("Run"))" i've 10 rows of data when it reaches to row 11 it throws me the error

thanks

 

tristaanogre
Esteemed Contributor

Right... as mentioned, it's reaching row 11 improperly, probably because that is an "Active" row in your spreadsheet.

 

Go to your spreadsheet, highlight the ENTIRE row that is the first "blank" row at the end of your data, right click, and select "Delete Row".  Save the spreadsheet and try again.


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
salley
Frequent Contributor

Thanks, that didn't seem like to work, so what i did i copied only first two columns into a different worksheet and it's working. so the question is why didn't it work on that sheet when i had no data on row 11 even after completely deleted the row. still it was throwing me error. 

tristaanogre
Esteemed Contributor

This is one of the reasons why I don't like Excel... there's no clear "end of file" in the actual spreadsheet.  If I'm going to use a file for data processing, I prefer CSV...

 

... but I'm convinced that somewhere in that initial data, you had some kinda of erroneous blank row that it's trying to process.  Glad that you corrected it with a new file.


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
salley
Frequent Contributor

Thank you so much for your help. I really appreciate your help. 

TC ! Cheers

cancel
Showing results for 
Search instead for 
Did you mean: