ERROR: This row already belongs to another table

Hi, I am trying to use the Build Data Table activity to store a list of values that I will later type into software. I obtain these values through a Read Range and then filtering that datatable. The tricky part is that the values I need to compile come from several ranges on different sheets within the same excel workbook. So right now, I have the workflow looping through each sheet to obtain all the values I need. However, the problem is that I need to save out the values from each sheet to a new datatable before it moves on to the next sheet. I tried adding a “For Each Row” activity and then an Add Data Row activity within that (see image). But I get an error: “Source: Add Data Row. Message: This row already belongs to another table”. Any ideas on how to fix this?

Hi buddy @katiea

Welcome to uipath community
Fine
Kindly pass the value in Array row property and not in the Datarow property like this
{value1,value2,valye3,value4}
These value1 value2 are based on no of columns in your table
Kindly try this and let know buddy
Cheers @katiea

1 Like

Hi, @Palaniyappan. Thank you. The error no longer shows up. I put {row.tostring} in Arrayrow instead of putting row in Datarow. However, when I output my new datatable to a message box it displays
Column1
System.Data.DataRow
System.Data.DataRow

instead of numbers.

I should also mention that if I output my datatable to a message box before the Add data row activity I get this image. So I would expect the message after the add data row to hold the same data but with a few more lines. Any ideas? Again, thank you so much for your help.
image

Buddy we need to mention the column name along with the row
Like this
**{row(“yourcolumnname”).Tostring,row(“Yourcolumnname”).

Cheers buddy @katiea

@Palaniyappan Thank you. I got values to display. However, it seems to only be the last two values, instead of all 4. I have the output for the new datatable outside of the looping activities. So I am not sure why it is not displaying all 4 values.

what were the first two values passed to add data row buddy
can i have a screenshot if possible
Cheers @katiea

@Palaniyappan I think I figured it out. It is working now. I had another activity that was still referencing the new DT by accident that was zeroing it out. Thanks so much for your help!

1 Like

Great
That referencing to zero must be the issue buddy
pass the value to the add data row with values that would surely let you get the message box with values
Cheers @katiea

1 Like