Converting numbers to decimal dot, and comma separated
Moderators: chulett, rschirm, roy
Converting numbers to decimal dot, and comma separated
Hi my friends...
I need to convert a number which represents an import, and instead of showing $9,876.54 I need to show $9.876,54. I mean, I ant my decimal point to be the comma ',', and the thousand separator to be the dot '.'.
I am using the Oconv function with the format MD2,$, but I'm getting the numbers in the other way around.
Thanks in advance, and have a nive day.
I need to convert a number which represents an import, and instead of showing $9,876.54 I need to show $9.876,54. I mean, I ant my decimal point to be the comma ',', and the thousand separator to be the dot '.'.
I am using the Oconv function with the format MD2,$, but I'm getting the numbers in the other way around.
Thanks in advance, and have a nive day.
Guillermo P. Barsky
Buenos Aires - Argentina
Buenos Aires - Argentina
This looks like you are trying to make the number look German. Without having NLS enable, try OCONV('1234567','MD2["$",".",",",""]')
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
gpbarsky, you need to bring your input into plain numeric format before using ArndW's code. So all together your expression will look like this
Code: Select all
Oconv(Iconv(in.Col,"MD2$"),'MD2["$",".",",",""]')
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Thats a tricky one.
A little Math can also help here.
A little Math can also help here.
Code: Select all
Ereplace(Ereplace(Ereplace('132,21.32', ',','*'),'.',','),'*','.') gives you 132.21,32
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
Thanks a lot to everybody.
I used the last given solution, which I consider the easiest. But, I had to convert in the following order:
1) Replace the decimal "." for a "-".
2) Replace all "," for the ".".
3) Replace "-" for the ",".
EREPLACE(EREPLACE(EREPLACE(num,".","-"),",","."),"-",",")
Again, I love this forum.
P.D.: does it exist an user guide for server jobs and sequencers ?
I used the last given solution, which I consider the easiest. But, I had to convert in the following order:
1) Replace the decimal "." for a "-".
2) Replace all "," for the ".".
3) Replace "-" for the ",".
EREPLACE(EREPLACE(EREPLACE(num,".","-"),",","."),"-",",")
Again, I love this forum.
P.D.: does it exist an user guide for server jobs and sequencers ?
Guillermo P. Barsky
Buenos Aires - Argentina
Buenos Aires - Argentina
Yes, there are Online Manuals/User Guides for server jobs and sequencers, it comes along when you install the software.
The logic is not in any guides, just gave it a thought!
Glad it helped :D
If you have resolved it, mark it as resolved (Ofcourse with your rating!)
The logic is not in any guides, just gave it a thought!
Glad it helped :D
If you have resolved it, mark it as resolved (Ofcourse with your rating!)
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
If you really want to go the text route, usenarasimha wrote:Thats a tricky one.
A little Math can also help here.Code: Select all
Ereplace(Ereplace(Ereplace('132,21.32', ',','*'),'.',','),'*','.') gives you 132.21,32
Code: Select all
CONVERT('123,456.78',',.','.,')
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Arndw,
I tried using your piece of code
I did not get the desired results. Am I missing something? Please advice.
I tried using your piece of code
Code: Select all
CONVERT('123,456.78',',.','.,')
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
Oops, I got the order of the parameters wrong. Sorry.
Code: Select all
CONVERT(',.','.,','123,456.78',)
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Server Job Developer's Guidegpbarsky wrote:P.D.: does it exist an user guide for server jobs and sequencers ?
Core Developer's Guide
Both manuals are in the Docs folder with your client software.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.