Add Data Row: This row already belongs to this table

Used “Add Data Row” activity to add Data row into a Data table. Adding data row takes place inside a ‘for each row in data table’ within a nested if condition. The first for loop entry which is present inside if condition can add its data row into data table, but the second entry which is present inside the else condition cannot be added with error. “Add Data Row: This row already belongs to this table.”

@sekargayathri94

arrayRow=row.itemarray in add datarow activity

Hi @sekargayathri94

Welcome to UiPath community

Check out the thread

Could you try to add this expression in the ArrayRow Field?

CurrentRow.ItemArray.ToArray()

Regards
Gokul

Hello @sekargayathri94

Welcome to UiPath community…!

You can do as below.

image

Thanks

Still I didnt get it.

I have the same problem. If I put the current row in DataRow, I get the error “This row already belongs to this table”, and if I put currentrow.itemArray in ArrayRow, I get “input array is longer than the number of columns on this table.” The problem is that a new data table has just been created and is clear, and the data table I want to copy rows from has 43 columns… Is there no way to copy entire rows from one data table to a new one, without having to build the entire header of the new one as a replica of the first one (since it is a very very long header)? Both methods fail!

Answering myself…it’s solved.
First, I clone the old data table:
dtNew=dtOld.clone()
then I can copy rows with row.itemArray in ArrayRow field

That’s all! :slight_smile: