How to add a new data column with Auto increment functionality to an existing datatable

Hi everyone!

I have an existing data table with more than 10000 rows and I want to add a new data column with auto increment functionality. I tried Auto increment option in add data column uipath activity but it is not setting any value. I can loop through the rows and increment it but it is taking very long time.

Is there any other way this can be solved. Appreciate the help!

Hi,

How about the following InvokeCode?

Sample20221020-2net.zip (2.7 KB)

Regards,

Hi @jyothirambhatla

The autoincrement property is only applied to newly added rows.

On the image below

  1. Get the source table (from your own source, i.e. Excel)
  2. Clone the datatable to your final table.
  3. Add a new column to your final table setting the autoincrement.
  4. Iterate the source table and add each row into the final table. You can pass the values as an array, leaving empty the value for the increment, this is achievable using CurrentRow.ItemArray
    BlankProcess_ForumHelp.zip (3.3 KB)
    .

Bests,
Andres

(post deleted by author)

Hi Andres,

Thank you for replying. I tried this method of for each, but I have around 30K records and looping through each row will not work for me.

Thanks !

Hi Yoichi,

Thank you for replying. This worked Perfectly !

Thanks !

1 Like

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