Compare 2 datatables problem

Hi, here is my code, I’m trying to compare 2 datatables but it end up looping the dt1

both datatables consists of 1 set of data from column A1 only

Hi @sophiey ,

Since there is only one line item in both datatables, it will only loop once right?
Also, could you please let us know what exactly it is that you wish to compare and what the expected output is?

Kind Regards,
Ashwin A.K

Hi Sophiey

Change the Range in Read Range Activity to double quotes like this “”

Regards

both dt has 1 column of IDs only.
have to compare 2 dts whether both set of IDs are matched.
if both set of IDs are matched, it will return true and go to next sequence else will check the next record

If you keep “A1” in the Range field. it will only read cell A1. So remove Range “A1” from the range field and enter “”. And also remember if there are headers in the excel file check the Add header property in the property panel of Read range.

Hi ,

Please change the read range field, if you want specify the Column ‘A’ specifically you can use “A1:A10”(depending on the data). Also check for the add headers properties whether checked or not. Inside the loop of second data table put a message box or write line to visualise the data.

Thank you

Hi @sophiey ,

Could you explain a bit more in detail as to what you mean by both set of IDs to match ? Are you checking if the first value in the First Datatable is equal to the First Value in the Second Datatable ? Does it have to be in Order ?

here is the example of one excel file. basically i need to compare 2 excel files which consist of the following data.

image

Hi @sophiey

You just need to change the range in the read range activity.

@sophiey Check this below attached workflow,
Uipath_CompareTwoDatatables.xaml (10.5 KB)

Hope this may help you :slight_smile: