how to compare the 2 data from the build table activity and save it in an excel sheet. the datatable some have the same data but place in a different order, i want it to have all the data from the 2 tables. also, the column name is different so do it so that the column name would be the same.
DT1.AsEnumerable.Where(Function(x) Not DT.AsEnumerable.Select(Function(y) y(“Name”).tostring).ToArray.contains(x(“FullName”).tostring)).CopyToDataTable.AsEnumerable.Select(Function(x) DT.Rows.Add(x.ItemArray)).CopyToDataTable
DT - Your 1st Data Table
DT1 - Your 2nd Data Table
DT1.AsEnumerable.Where(Function(x) Not DT.AsEnumerable.Select(Function(y) y(“Name”).tostring).ToArray.contains(x(“FullName”).tostring)).CopyToDataTable.AsEnumerable.Select(Function(x) DT.Rows.Add(x.ItemArray)).CopyToDataTable
Iterate DT1 (2nd data table) each item and checking whether that item is available in DT (1st Data table).
What are the iterated items (DT1)are not available in the DT, those items are carried as data table. Consider as TempDT(Which has unmatched records of DT)
TempDT = DT1.AsEnumerable.Where(Function(x) Not DT.AsEnumerable.Select(Function(y) y(“Name”).tostring).ToArray.contains(x(“FullName”).tostring)).CopyToDataTable.
Then. Iterate TempDT and add into the existing datatable DT. This is your output Datatable
You will get your expected output with combination of this 2 expressions.
DT1.AsEnumerable.Where(Function(x) Not DT.AsEnumerable.Select(Function(y) y(“Name”).tostring).ToArray.contains(x(“FullName”).tostring)).CopyToDataTable.AsEnumerable.Select(Function(x) DT.Rows.Add(x.ItemArray)).CopyToDataTable