Page 1 of 1

Fmt vs DecimalToDecimal/DecimalToString

Posted: Thu May 14, 2009 7:01 pm
by tracy
I have a Decimal(11,2) that I want to add to a Sequential file in a Varchar field. For instance, I want to see "Total: 9999.99" in the Sequential file.

I'm finding that it's not always showing the 2 decimal places.

So I went searching for a way to force it to always show 2. I've seen discussions on DecimalToDecimal and DecimalToString, but I didn't get anywhere with those.

I finally stumbled upon Fmt(number, 'R2') which seems to be doing the trick. This seems so easy, so I'm wondering why this hasn't been in any of the posts I've seen here regarding showing the decimals. Is there something wrong with this?

Posted: Thu May 14, 2009 7:55 pm
by chulett
No, nothing wrong with it and it's out there in posts. DecimalToString() should have worked as well AFAIK, what syntax did you try?

Posted: Thu May 14, 2009 8:00 pm
by Kryt0n
DecimalToString is a parallel function isn't it?

Posted: Thu May 14, 2009 8:05 pm
by chulett
Why, yes it is. Since the question was about contrasting the two approaches, I kind of ignored the Server job type / posted forum part. Perhaps that explains the "didn't get anywhere" comment. :wink:

Posted: Thu May 14, 2009 8:11 pm
by tracy
Thanks!

Since I got the "nothing wrong with it" response I was looking for, I'll follow your lead and ignore the rest of this so I don't waste anymore of your time. :wink:

Posted: Thu May 14, 2009 8:24 pm
by Kryt0n
chulett wrote:Why, yes it is. Since the question was about contrasting the two approaches, I kind of ignored the Server job type / posted forum part. Perhaps that explains the "didn't get anywhere" comment. :wink:
I have a tendency to ignore that section too, just doesn't seem to stand out for me...