Can we extract the decimal part alone using Iconv/Oconv.
I arrived at the solution by using the following code.
Substrings("3435.676",Index("3435.676",'.',1)+1,Len("3435.676"))
But it seems to be a round about.
Can we achieve the same using Iconv or Oconv....
Thanks
Can we extract the decimal part alone using Iconv/Oconv
Moderators: chulett, rschirm, roy
Hello Kruthika,
although ICONV and OCONV are quite efficient functions, they are a bit too powerful for your specific request and will not be the most efficient. The INDEX function as you have used it is fast, you could also use the FIELD function if your number is in the format "nnnnn.dddd", i.e. FIELD(In.mynumber,'.',2) for that portion after the decimal.
You can also use the INT() function to strip off decimal portions or if you really wish to stick with ICONV/OCONV look at the MD conversion code description in the Basic User's Guide pages 819 onwards.
although ICONV and OCONV are quite efficient functions, they are a bit too powerful for your specific request and will not be the most efficient. The INDEX function as you have used it is fast, you could also use the FIELD function if your number is in the format "nnnnn.dddd", i.e. FIELD(In.mynumber,'.',2) for that portion after the decimal.
You can also use the INT() function to strip off decimal portions or if you really wish to stick with ICONV/OCONV look at the MD conversion code description in the Basic User's Guide pages 819 onwards.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Re: Can we extract the decimal part alone using Iconv/Oconv
Sorry, I forgot to suggest a modification of what you did that would perform somewhat better:kruthika wrote:Can we extract the decimal part alone using Iconv/Oconv.
I arrived at the solution by using the following code.
Substrings("3435.676",Index("3435.676",'.',1)+1,Len("3435.676"))
But it seems to be a round about.
Can we achieve the same using Iconv or Oconv....
Thanks
In.MyNumberColumn[INDEX(In.MyNumberColumn,'.',1)+1,999]
The "999" is meant to be longer than the rest of the string, DS will stop parsing at the end of the string. This saves your LEN() call [which, if you wanted to be correct, needs to be decremented by your start position; but because DS does stop at the end of the string will work nonetheless )
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>