hello everyone.,
i have a coumn with 10 digits as column length. data type is integer.if they length of the column is less then 10 digits then it should be left padded with zeros untill it is 10 digits long.
i have to write this entire logic in parallel transformer. i am working on DS v.7.5
can anyone please tell me how do i check if the column length is 10 digits and if it is less than 10 digits, then how to leftpadd with zeros untill it is 10 digits.
i appreciate your sincere help.,
thanks
mark
left padding with zeros
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi studyguy2001,
You can achieve it
1) If you use the Basic Transformer in your job, you can use the below the transformation
Alternatively, you can use some custom logic to check the length of the field and see how many digits it is less than 10 and concatenate that many number of zeroes to the left of the original string.
You can achieve it
1) If you use the Basic Transformer in your job, you can use the below the transformation
Code: Select all
FMT(InLink.Col1,"10'0'R")
Alternatively, you can use some custom logic to check the length of the field and see how many digits it is less than 10 and concatenate that many number of zeroes to the left of the original string.
Thanks,
Naveen
Naveen
-
- Participant
- Posts: 19
- Joined: Tue Feb 01, 2005 11:46 pm
left padding with zeros
hello naveen.,pnchowdary wrote:Hi studyguy2001,
You can achieve it
1) If you use the Basic Transformer in your job, you can use the below the transformation
Code: Select all
FMT(InLink.Col1,"10'0'R")
Alternatively, you can use some custom logic to check the length of the field and see how many digits it is less than 10 and concatenate that many number of zeroes to the left of the original string.
thanks for your reply. unfortunately i am working on parallel extender. hence i can't use the basic transformer. alternately.,
i know how to use the concatenate.i have defined a stage variable and used the len() to calculate the length of the field.
but after this i am not able to procced further. i have the length of the field stored in a stage variable. if the length of the field is 8 digits then it has to be left padded with 2 zeros, if it is 9 digits then it has to be left padded with 1 zero.
i am now not able to resolve this issue.
i thanks you for your input regarding this.
thanks
mark
i
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi Studyguy,
The Basic Transformer is even present in parallel jobs, Please refer to this thread, if you dont see it in you pallette viewtopic.php?t=86847.
That being said, the Basic Transformer will have some negative impact on your jobs performance, as it has to run in sequential mode.
However, here is an tranformation that will achieve the same without the use of a Basic Tranformer
Let me know, if this works for you.
The Basic Transformer is even present in parallel jobs, Please refer to this thread, if you dont see it in you pallette viewtopic.php?t=86847.
That being said, the Basic Transformer will have some negative impact on your jobs performance, as it has to run in sequential mode.
However, here is an tranformation that will achieve the same without the use of a Basic Tranformer
Code: Select all
Str("0", 10 - Len(InLink.Col1)):InLink.Col1
Thanks,
Naveen
Naveen
-
- Participant
- Posts: 19
- Joined: Tue Feb 01, 2005 11:46 pm
left padding with zeros
hello naveen.,
thanks a lot is working.. :D
thanks a lot is working.. :D
-
- Premium Member
- Posts: 353
- Joined: Wed Apr 06, 2005 8:45 am