Forum Discussion

malj's avatar
malj
Contributor
9 years ago

Problem with DDT.CurrentDriver.Value(i)

I am having a problem reading values from a csv file using the code below. I have created a schema.ini file with contents below and it seems to be found and used. DDT.CurrentDriver.Value(i) returns null but DDT.CurrentDriver.ColumnName(i) gives me the column names as specified in the schema.ini file. Any ideas?  

 

[sequence.csv]

Format=Delimited(;)

DecimalSymbol=,

ColNameHeader=True

MaxScanRows=10

Col1=nejm Text Width 10

Col2=adress Text Width 30

Col3=whatever Text Width 10

 

 

DDT.CSVDriver("C:\Users\malj\AppData\Local\Temp\sequence.csv")

While Not DDT.CurrentDriver.EOF() 

  For i = 0 To DDT.CurrentDriver.ColumnCount - 1
    Log.Message DDT.CurrentDriver.ColumnName(i) & ": " & DDT.CurrentDriver.Value(i)
  Next

  DDT.CurrentDriver.Next()

WEnd

3 Replies

  • malj's avatar
    malj
    Contributor

    I have attached the file. It contains only one column but that is all I need right now. I was able to use a project variable of type DB Value as described in the Help to read the values but then I have to point to a specific csv file before running a test. I would prefer being able to do that at runtime like I could in previous TestComplete versions (and without having to use DB Value project variable). Is this possible?

     

    I noted that I have no HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet registry settings on my machine. Am I missing something? Anyway, with the Schema.ini file available it should not be necessary.  

     

    I can (and did) of course implement reading of the file's data myself so this is not a big issue.

    • NisHera's avatar
      NisHera
      Valued Contributor

      Seems file is being corrupted 

      Just copy some of lines to a new csv and run.... if works a problem with file.