I want to compare two data tables. I need to compare each and every cell of first data table with those of the second data table (I. E., I need to find a row based on s.no. If that matches then each and every cell of that row has to be compared. ) and add those cells that aren’t same into a separate data table.
You can use the DataTable.Rows.Contains method to check if the table already contains a row with same data. The check is done comparing the values in the columns set as Primary Key. So, first we need to set the primary key to the columns we want to use for check.
See attached example on how to use the DataTable.PrimaryKey property and DataTable.Rows.Contains method. CheckDuplicates.xlsx (8.5 KB) CheckDuplicates.xaml (10.9 KB)
Dear @Ananthu
I tried to use your Comparison logic.xaml file.However, when process comes to Assign counter=counter+1 I got message:
Object reference not set to an instance of an object. This error usually occurs using a variable with not set value (not initialized).
I will appreciate if you can explain how to fix it. test1.xlsx (16.6 KB) DD.xaml (24.1 KB)
In the finale I want to get 3 rows on the sheet C which contains differences…
would you be so kind to explain me some problem with code. I use it and I got mistake…it is count every second column of the table (not each) AExample.xaml (31.8 KB) test1.xlsx (17.4 KB)
Hi @Aggi,
The problem with your test1 excel sheet is that it haven’t got any unique element to map across sheets for comparison.
In the attached workflow, I have used the row index as unique element and did the comparison. Kindly let me know if you face any issues. AExample.xaml (34.9 KB)