Data table comparison

Hi All,

In my project i’m doing comparison of two data tables. Comparing DT2 with DT1. If there are any unmatched rows the rows in DT1 in comparison with DT2, The rows are added to an existing workbook. Everything is running good . But the case here is if there are NO unmatched rows the ROBOT is coming out of the process. The comparison code is in the try catch. I can see error message in the output window. I’m using below code for comparison.

DT1.AsEnumerable().Where(function(row) Not DT2.AsEnumerable().Select(function(r) r.Field(Of String)(In_DT2_ColName_To_Match.ToString)).Any(function(x) x = row.Field(Of String)(In_DT1_ColName_To_Match.ToString))).CopyToDataTable()

Can anybody suggest me how to proceed on this.

1 Like


Can you share the error message/screenshot and the excel files if they are not confidential…

Also can you share workflow xamls if there are some errors to dissect.

Regards :slight_smile:

HI @sridhar1516

yes. if no datarow select then it will throw error only … what u want to do if “No Unmatched row getting”

put trycatch for Assign activity otherwise…convert to data row … otherwise u want perform anything if “No Unmatched row get”

hi @sridhar1516,

in the above code remove the CopyToDataTable() function in end.
then you will get the Array of DataRows
then use if condition like the length of the above statement is > 0 convert to DataTable else skip

hope this helps you… :slight_smile:

Thanks @venkat4u will try and let u know the output.

Thank you @amaresan well if “No Unmatched row getting” i just want the process to end without showing any error.

Thanks fro the responce @Raghavendraprasad. Sure will try to share the files with certain changes.

@amaresan Already the assign activity is in Try catch. The code is running successfully but after execution i can see the error in the output window.

did u manage to get this done, can share the linq?