Tuesday 24 December 2013 @ 11:12 am
One of my customers was reading data from XML. He ran into an amount field stored as a string and noticed that some of the values had been converted to scientific notation. They looked something like “1.234E+6”. He asked if there were a way to convert those back to the original number. After a bit of playing around I came up with the following, which works with most styles of “E” notation that I have seen.
Local StringVar Input := Replace ({@input}, '+', '');
if "E" in Input then val(Input) * 10^ val( Split (Input, 'E')[2] ) else val(Input)
If the field doesn’t have an “E” in it the formula returns the value of the number. It should also work if the E is followed by a plus, a minus or nothing or even if the plus or minus is at the end instead of right after the E.
(For examples of my most popular formulas, please visit the FORMULAS page on my website.)






