Page 1 of 1

formatting a number

Posted: Mon Apr 20, 2009 5:26 am
by Aggie99
hi guys,

I need to write out numbers to a sequential file with commas.

eg:

input -> 1000000

output -> 1,000,000

Is there any function in transformer that I can use?

thank you,
aggie

Posted: Mon Apr 20, 2009 7:28 am
by chulett
You'll need to define the output field as a string, then use something like FMT() to get what you want. There are other ways, I'm sure, but that's the first that comes to mind.

Posted: Mon Apr 20, 2009 8:20 am
by Mike
You'll definitely need to define the output as string. The "something like FMT()" part is not quite so easy since "they" decided not to create a parallel function equivalent to the BASIC function.

If you have a small number of these to do, you could brute force it with DecimalToString, substring, and concatenation.

If you have a large number of these, you may want to consider creating a custom parallel routine.

Mike

Posted: Mon Apr 20, 2009 8:41 am
by chulett
FMT() doesn't work in a parallel job? That's too darn bad. :?

Posted: Mon Apr 20, 2009 3:54 pm
by ray.wurlod
But you CAN use Fmt() in a BASIC Transformer stage.