The row index in table b for that duplicate is row index 1 (row 7) - could also be row index 3 (row 9), it doesn’t matter which row the bot picks up as long as it picks up a duplicate
(From d in dtA.AsEnumerable()
Let ia = d.ItemArray
Let idx = dtB.AsEnumerable.ToList.FindIndex(Function (d2) d2.ItemArray.SequenceEqual(ia))
Where idx > -1
Let ra = ia.Append(idx).toArray
Select r = dtReport.Rows.add(ra)).CopyToDataTable
We are checking the first occurence of a dtA row in dtB
And writing within the the report: the values + the 0-Based index
SequenceEqual will work when the structure and DataTypes of dtA and dtB are the same
(From d in dtA.AsEnumerable()
Let ia = d.ItemArray
Let tl = MarkedRows.Where(Function (t) t.Item2.ItemArray.SequenceEqual(ia))
From tf in tl
Let ra = ia.Append(tf.Item1).toArray
Select r = dtReport.Rows.add(ra)).CopyToDataTable
We would also highlight that this use case can also be done with few other options as alternates
There is one duplicate (row 7 ) in tableA that is in tableB - in tableB this duplicate is located in row index 1 (row 7)
So the data table/list will be:
Note the row index is the position of the duplicate row in tableB and the table starts at row 7
This number is then fed into the remove row activity - note the reason I am using the remove row activity and not just removing the duplicates is because the number of duplicate rows in tableA is proportional to the number of duplicate rows that need to be removed in tableB
Another example with more detail of the desired output:
TableA: