How to generate unique number in 1 existing column

i want to create or generate the unique number in 1 existing column(template)
please help me. thanks

exp:
0001
0002
0003
0004
0005

@syaheed22

Serial number in column?

Dt.rows.count add this in your add data row activity as a input for column

1 Like

Hi @syaheed22.
Please use a Int32 variable as a counter and set it to 1.
Then to add a leading zeros, use this formula.
counter.ToString.padleft(4,CChar(“0”))
Thanks and regards. :slight_smile:

11 Likes

Hi @syaheed22

You can also have an auto incrementing id column. First build the datatable using build data table activity without the id column. Then add a add data table column activity and mention the created datatable. In this activity there is a property called auto increment. Select it. Now your data table is ready. Now everytime you add data to your datatable the id column will have a number generated automatically

2 Likes

@Lahiru.Fernando
Thanks buddy…

1 Like

can u explain more?
my output:
Add data row : Input string was not in a correct format.Couldn’t store <> in 2 Column. Expected type is Int32.

Hi @syaheed22

Looks like you are trying to add a string value to a datatable cell while it accepts only int32 type. Are you trying to add a value to the auto incrementing id field here? If so, you dont need that to be added as it will be adding the row number on its own when you insert records to it.

1 Like