Hello all,
I have a string (ex: 34567891). I want to append zeros to the left of this string until total length is 17. I know that it could be achieved by using PADLEFT(my_string_field, 17,'0'). But it will give me only one output i.e.
00000000034567891.
But what I want as output is all values till length 17 is reached.
Something like this:
034567891 - length 9
0034567891 - length 10
00034567891 - length 11
000034567891 - length 12
0000034567891 - length 13
00000034567891 - length 14
000000034567891 - length 15
0000000034567891 - length 16
00000000034567891 - length 17
How do I achieve this ?
Solved! Go to Solution.
@shobhit_gupta I used a Text Input tool with numbers 9 through 17 (Number) then called that in my PadLeft expression in the Formula tool.
Thank you @Prometheus . But the thing is, my input string will not always be of length 8. It could be like 34567 also. In this case, we'll have to start from 7 in the text input tool. how do we change it in the text input tool depending on the length of the input string and increment it by 1 till length 17 is reached ?
I would use a formula tool to hard code Length as 17 and String Length as the length of input string. Then I would use the Generate Rows tool to update String Length until String Length is 17. Then I would simply use the PadLeft.
Hi @tirthin8 , can you please share the screenshot of generate rows tool ?
Let me know if this works for you.
Thank you so much! This is very helpful and fits perfectly for my use case.