Page 1 of 1

Pad zero on leftside to integer

Posted: Tue Apr 12, 2011 10:38 am
by eswar1
Hi,
My source values are like :
2
3
10
100

My required target is :
002
003
010
100

Please help me how to pad zeros on left side to an integer using transformer stage.

Thanks,
Eswar

Posted: Tue Apr 12, 2011 11:36 am
by samsuf2002
You can use FMT().
Do a search to find out how, based on your requirement.

Posted: Tue Apr 12, 2011 12:10 pm
by FranklinE
You may be a bit confused here: integer is a storage format, but you are describing a requirement for displaying the data.

The easiest way to handle this is to convert the integer to a char or varchar before sending it to your display output. The only alternative is to store it in the display format, but that's not efficient for disk or processing.

Posted: Tue Apr 12, 2011 4:49 pm
by ray.wurlod
samsuf2002 wrote:You can use FMT().
Do a search to find out how, based on your requirement.
Fmt() is not available in Parallel jobs.

Provided the target is a string, you can use string functions to pad with leading zeroes. For example:

Code: Select all

Right("000" : InLink.TheValue, 3)