Elegant decimal data conversion?
Posted: Fri Apr 13, 2007 3:05 pm
Greetings.
I've searched the forums for most of the day and looked around, and didn't see this addressed. So I thought I'd bite the bullet and post this question. As a bit of back story, I've been using older versions of DS for a good number of years, and only recently came on board to a company that's using parallel extender. So I'm still getting used to how variable data types are more important in PE than in older versions.
So.
I have a decimal field coming in on a link, and I want to write it to a delimited flat file. If I do so as a decimal, I get [space]123.. That is, I get the space for the sign, and the trailing decimal even if there is no mantissa.
I don't want this. I want no leading spaces (or zeros) and I want the decimal suppressed if not needed. If I drop this into a VarChar, that doesn't help. Nor does the DecimaltoString function. In the old world of server jobs, I would probably use something like oconv to make this happen.
Is there a simple, elegant way to do this in a PE transform that I'm overlooking? I searched the help files for various numeric and string functions, but didn't find anything applicable.
Yes, I know I can drop it into a VarChar and then strip off the unwanted parts with embedded TRIM statements. But I would think there's a simpler method that I'm missing. Since as I mentioned, I'm fairly new to the ways of the parallel transformer world.
Any ideas?
Thanks - Richard, Milwaukee, WI
I've searched the forums for most of the day and looked around, and didn't see this addressed. So I thought I'd bite the bullet and post this question. As a bit of back story, I've been using older versions of DS for a good number of years, and only recently came on board to a company that's using parallel extender. So I'm still getting used to how variable data types are more important in PE than in older versions.
So.
I have a decimal field coming in on a link, and I want to write it to a delimited flat file. If I do so as a decimal, I get [space]123.. That is, I get the space for the sign, and the trailing decimal even if there is no mantissa.
I don't want this. I want no leading spaces (or zeros) and I want the decimal suppressed if not needed. If I drop this into a VarChar, that doesn't help. Nor does the DecimaltoString function. In the old world of server jobs, I would probably use something like oconv to make this happen.
Is there a simple, elegant way to do this in a PE transform that I'm overlooking? I searched the help files for various numeric and string functions, but didn't find anything applicable.
Yes, I know I can drop it into a VarChar and then strip off the unwanted parts with embedded TRIM statements. But I would think there's a simpler method that I'm missing. Since as I mentioned, I'm fairly new to the ways of the parallel transformer world.
Any ideas?
Thanks - Richard, Milwaukee, WI