Forum Discussion

Mike359's avatar
Mike359
Occasional Contributor
3 years ago

DDT.ExcelDriver Sometimes Truncates Long Strings at 255 characters.

Hi 

I am using the DDTDriver  - to drive my data driven tests using spreadsheet

 

ie. MainDriver = DDT.ExcelDriver(Path + Workbook, Sheet, true);

 

I have found, on some of the sheets I have in my workbook, it sometimes truncates long strings held in cells in the sheet to 255 chars. ie [ observe = aqConvert.VarToStr(DDT.CurrentDriver.Value(i));  so that the variable 'observe' contains a string that is only 255 chars long, but the value held in the spreadsheet cell is actually much longer ] 

BUT oddly it does not do this all the time!

 

I have a spreadsheet with 4 columns and 11 rows

The first row holds the column names 

The next 10 rows hold the data under those columns.

In the 3rd column on the last row (by using DDT.CurrentDriver.Next() as I move through the rows )- the cell holds the lengthy string value. I get its value using aqConvert.VarToStr(DDT.CurrentDriver.Value(2)); -  and the value retrieved, is always a truncated string 255 chars long.

If I remove a 2 rows above, in the spreadsheet, so it is now only 8 rows long (it does not matter which rows I remove) the cell that holds the lengthy string now correctly has all the characters retrieved from the spreadsheet cell!

 

Any suggestions why this odd behaviour may be happening?

Has anyone experienced the same or found a solution? I am using Excel 2016. I have tried with and without the ACEDriver parameter value ie true/false but that makes no difference.

 

 

Many Thanks in advance 

 

  • Hi, I think I have found the cause. ğŸ˜€

    I found this section in the documentation:

    It would explain the behaviour. Adding it so others might also benefit from it. (Simple solution is to include a long string in the first 8 rows of your DDT test, then other rows will not be truncated).

  • I have found that occasionally Excel sheets will become corrupt and do funny things with the data. Not sure if this is the case here, but you might try using the same 10 rows of data in a brand new sheet and see what happens.

     

    For one of our projects this ended up happening so much that we switched to .csv files instead of Excel, at least for reading the data. 

     

     

     

     

  • Mike359's avatar
    Mike359
    Occasional Contributor

    Thanks Marsha for the comments, 🙂 it is good to know others have experienced the same sort of issues and it is not just me. I will continue to play around with it to see if I can get any closer to the cause.

    • Mike359's avatar
      Mike359
      Occasional Contributor

      Hi, I think I have found the cause. ğŸ˜€

      I found this section in the documentation:

      It would explain the behaviour. Adding it so others might also benefit from it. (Simple solution is to include a long string in the first 8 rows of your DDT test, then other rows will not be truncated).