Forum Discussion

alexhdz2007's avatar
alexhdz2007
Occasional Contributor
5 years ago
Solved

Testcomplete does not input data from CSV in desired format

I am currently having an issue with how testcomplete inputs some of the numerical values from a CSV file. It seems it will not insert them in the format I need them to be in.

For example, I will have a list of values such as:

1.25

1.50

2.00

 

These must be entered in that format for verification purposes, but testcomplete enters them as:

1.25

1.5

2

 

Is there some setting that I missing to be able to keep the desired format?

 

*Please note: I cannot provide any images as my company has testcomplete running on a private network.

 

  • The problem is that TestComplete will attempt to convert the content of the CSV data field into whatever seems to closely match the data type.  In this case, it sees what looks like numbers and converts them into numeric values, stripping off the extra zeros.

     

    In order to force them to actually keep the xtra zeros, you will need to do one of two things.

     

    1) Easy - Wrap all your values in your CSV file with quotes to indicate they are strings, not numbers.  This will ensure the zeroes are preserved as part of the string.

    2) Advanced (but not hard) - Utilizes a schema.ini file along with your CSV (https://docs.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver?view=sql-server-2017) to indicate the specific data formats to be used for each column in your file.

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The problem is that TestComplete will attempt to convert the content of the CSV data field into whatever seems to closely match the data type.  In this case, it sees what looks like numbers and converts them into numeric values, stripping off the extra zeros.

     

    In order to force them to actually keep the xtra zeros, you will need to do one of two things.

     

    1) Easy - Wrap all your values in your CSV file with quotes to indicate they are strings, not numbers.  This will ensure the zeroes are preserved as part of the string.

    2) Advanced (but not hard) - Utilizes a schema.ini file along with your CSV (https://docs.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver?view=sql-server-2017) to indicate the specific data formats to be used for each column in your file.