This row already belongs to another table error while copying the row from one data table to another

I am getting the following error while copying the row from one datatable to another:
Add Data Row: This row already belongs to another table.

I want to compare the particular column in the datatable and if that matches, I want to copy that
particular row to another table. So to accomplish the same I doing the following:

  • Stored the excel content in one data table and used it in for each to read row by row
  • inside the foreach I am using if condition to filter the particular column field
  • if that matches, then I am using Add Data Row activity to add that corresponding row to the new data table.
  • Finally I will be writing this new data table to the sheet using Write Range activity.

Please find the below .xaml file and help me to resolve this.Main.xaml (15.4 KB)
Tests.xlsx (8.4 KB)

That is because you are using the same row which needs to be copied to next DT, instead use Get Row Item activity and have your Column values in different variable then pass those variables in Add Data Row activity

Or you can do this even

dtNew = dt.Select("[Type]='WI5'").CopyTodataTable

This will give you a new datatable with only WI5 items


1 Like

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