If Stringlength is 1 add

Hello Community, good day.

I am very new and hope for some advise

I am reading a csv to a table and then processing it with a for each row in “table” loop.
This works fine.

Now I have a problem in the source. Excel converts “002” in “2” and kills the precending two zeroes.
The column name is “Number”
I am inputting the data for each row in a field. The expression I use is : row(“Number”).ToString

Unfortunately I need to check the length before. The length must be 3.
In case length is 1 then it needs to add 2 x zero before the string value
In case length is 2 then it needs to add 1 x zero before the string value

Anyone here that can help a nOOb ?

Best regards

Hi @my_list

Use if condition and check it as


use format value activity and pass the value as 2 in else use format value activity and pass it as 1

use write range and pass the values as “2”+row(“Number”).ToString
for else pass the values as row(“Number”).ToString+“1”

Ashwin S


For Strings you can use a method filling Up with a specific Character to a certain length

Give a try on Padleft method and fill Up with 0 to the length of your choice

Hi AshwinS2 & ppr
thanks! which activity do I use in the if condition to declare the variable with the Padleft ?


Try this… ! @my_list


@ kadiravan_kalidoss : thanks!! Works fine.


There is no need for an If Activity
Just use an assign Activity

Padleft will Work dynamicly till String length ist reached

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.