Converting exponential notation to integer
Moderators: chulett, rschirm, roy
The data cannot be correctly read in at the source (thanks to an excel source file with 600K rows and the way that the unstructured data stage works).
The "E" is indeed base 10 exponential; I thought about the mathematical approach and think that it will take longer than the string approach.
I should add that the output value is a string column, so the computation above still needs to be converted from a decimal/numeric to a string using some method such as the embedded trims above.
Addendum - I just ran a test and the original solution is faster.
The "E" is indeed base 10 exponential; I thought about the mathematical approach and think that it will take longer than the string approach.
Code: Select all
svTrimNoLeading[1,LEN(svTrimNoLeading)-2]*(10**Right(svTrimNoLeading,1)
Addendum - I just ran a test and the original solution is faster.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
The decimal-to-string conversion just has the "fix_zero" option to allow a 0 value, but no suppress zeroes.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I can't find it in my documentation for the DecimalToString.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Yes, I did try AsInteger(). It does work with dfloat, but converts to a binary representation and thus isn't feasible in this context.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Cool - the statement is now
and that is faster and easier to understand.
Code: Select all
DecimalToString(DFloatToDecimal(svtest),"suppress_zero")
and that is faster and easier to understand.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>