Get all uncommon rows and ignore last column

I currently have two datatables: WorkDT and FinalCompletedDT
I have this expression to get all the rows that are different between the two datatables

When comparing the two, I would like it to ignore WorkDT’s last column, therefore compare everthing other than the last column from WorkDT
However, after I know which rows are different between the two tables, I’d like to get the complete datatable of those rows that are different, including the last column.
How can I achieve this?

Hi

To get the unmatched records first between two datatable use this in a assign activity

dt_final = dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

And you can use REMOVE DATACOLUMN activity to remove the last column you want
https://docs.uipath.com/activities/other/latest/workflow/remove-data-column

Cheers @Joanne_Chang_LAX

I only need to remove it when comparing though
Once I get which rows are different, I need the different rows with the last column

Hi,

How about the following expression?

dtResult = WorkDT.AsEnumerable.Take(WorkDt.Rows.Count-1).Except(FinalCompletedDT.AsEnumerable(),DataRowComparer.Default).Concat({WorkDt.AsEnumerable().Last()}).CopyToDataTable()

Regards,

@Joanne_Chang_LAX

You can try this

Dt1.AsEnumerable.Where(function(x) dt2.AsEnumerable.Where(function(y) y.itemArray.Take(dt2.Columns.Count-1).SequenceEqual(x.itemArray.Take(dt1.Columns.Count-1))).Count=0).CopyToDataTable

Hope this helps

Cheers

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