RunningShoes Library for WinRunner
Custom WinRunner Functions
A Random Collection of WinRunner Solutions
Creating DLLs for WinRunner
Data table problem entries: leading zeros, formatted dates, etc.
Test cases often require numeric data values that can contain leading zeros. However, if you simply enter a number with leading zeros in the data table, the leading zeros disappear.
For example, a zip code in New England could be 00123. Entering that number in either Excel or WinRunner's Data Table editor results in a cell entry of 123. The zeros are gone.
The problem appears in a variety of other ways, such as a value that Excel recognizes as a date and converts to a different date format.
In the extreme, the data table can freeze with scientific notation, such as 6.02E23. Some versions of WinRunner's Data Table cannot handle such entries, often causing the editor to freeze. Again, the solution is the same.
The solution is simple. Enter an apostrophe ( ' ) as the first character in the cell, followed by the number with leading zeros. Do not add any space between the apostrophe and the number. The apostrophe will not show up in the cell, and it will not be read when WinRunner retrieves the cell's value. The only difference you will notice in the cell's entry is that the number is left justified in the cell, while numbers without the apostrophe are right justified.
Why it works
The apostrophe indicates that the entry is text (a string) rather than a number, so the editor leaves it alone. Without the apostrophe, the entry is a number, and since leading zeros are meaningless in a number they are thrown out.
A second approach for some types of entries is to format the cell as text. While this works well for leading zeros, dates can still be a problem. In Excel, dates are stored as integers indicating the number of days since January 1, 1900. Formatting them as dates in the desired format can be a problem, especially when different formats are mixed. Use whichever method works best for you.
Copyright R. E. Cook Consulting, 2000 - 2011.
The site is designed to look best when viewed with Internet Explorer 5.0 - 8.0. Results with other browsers will probably deviate from what is intended.
NOTE: This website refers to registered trademarks and service marks that are owned by other companies, including Mercury Interactive, WinRunner, TestDirector, TSL, Microsoft, Windows.