cancel
Showing results for 
Search instead for 
Did you mean: 

Testcomplete does not input data from CSV in desired format

SOLVED
Highlighted
New Contributor

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Testcomplete does not input data from CSV in desired format

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...) to indicate the specific data formats to be used for each column in your file.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
1 REPLY 1
Community Hero

Re: Testcomplete does not input data from CSV in desired format

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...) to indicate the specific data formats to be used for each column in your file.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Join the September Hub-bub to show off, learn and win