Forum Discussion

salley's avatar
salley
Frequent Contributor
6 years ago
Solved

Returning Null when trying to read data from Excel using DDT driver

Hi, I'm using DDT driver to read data from the excel. i've two column in Excel , sayg COL1=100,200 and COL2=100000,200000. For somereason COL2 is returning me Null Values, but when i changed the Da...
  • tristaanogre's avatar
    6 years ago

    100,200 is a valid integer (one hundred thousand two hundred)

    100000,200000 is not.  The DDT driver tries to match the data in the column to the next best data type.... if you're not designating it as text, I'm guessing it's TRYING to read it as integer... and since it's an invalid INT value due to the comma placement, it's failing.

     

    My thought is that you SHOULD be making these columns "Text" value anyways.  You're treating them as strings to split around a separator character so you should attempt to force the data to be read as a string.

  • RUDOLF_BOTHMA's avatar
    6 years ago

    If, as tristaanogre suggests, you want to force excel to be text, you could add a single quote to the value in the cell formula. e.g. '10000,20000 rather than 10000,20000.  This forces excel to report the value as a string.  If you just change the cell format to be a "general" or "text", this translation sometimes turns out wrong.  eg. saving "0001" changes the value to "1".  If you do indeed want to work with integers, you should probably still consider storing them as string and in TC use

    aqConvert.VarToInt(Trim(DDT.CurrentDriver.Value("Col_A")))

    or something similar