Forum Discussion

salley's avatar
salley
Frequent Contributor
7 years ago
Solved

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

  • 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.

6 Replies

  • tristaanogre's avatar
    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.

  • salley's avatar
    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's avatar
      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.

      • salley's avatar
        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.