Linq Except

Hey Team i have two datatable namely dt_Comparison
dt_Comparison
and dt_ned_compare
dt_Ned_Compare
i want to get rows that are in dt_comparison but not in dt_ned_compare this is my expression
Expression
which produces
OutPut Results
Can you please advice what is it m doing wrong

The syntax looks fine at a first glimpse.

It can be the case that small things are the reason, as the data comes from excel: different interpretation of the data to data column datatypes, the date values and time portions.

Here we would check a common row from both dts within the immediate panel

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

like:
dt1.Rows(1).ItemArray
dt2.Rows(0).ItemArray
dt1.Rows(1).ItemArray.SequenceEqual(dt2.Rows(0).ItemArray)

As a last ressort we can also check for an alternate LINQ / Approach

1 Like

Hi @mpho.ndoweni

  1. Use “Read Range Workbook” activity and read both the Excel files and store it in data Table say dt1 and dt2.
  2. Use Assign activity and give below condition:
dt_Result= dt1.AsEnumerable.Except(dt2.AsEnumerable, System.Data.DataRowComparer.Default).CopyToDataTable

(dt_Result datatype is System.Data.DataTable)
3. Use “Write Range Workbook” activity to write the data table to excel.

Check out the below xaml file.
Sequence21.xaml (7.9 KB)

Output excel:

Hope it helps!!
Regards,

1 Like

Thank you very Peter

It works Parvathy thank you very much

@mpho.ndoweni

If you find solution for your query please mark it as solution to close the thread.

Happy Automation
Regards,

1 Like

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