Compare Datatables one specific column with other specific Column with "contains" or "like"

Continuing the discussion from Compare Datatables one specific column with other specific Column and Get Matched and Not Matched Records`:

Regarding the topic from above:
Now I’m struggling with the fact, that i don’t need exact matches but a “like” or “contains” condition. The values of column x from dt1 should contain the values of column y from dt2. I really don’t have an idea how to solve this in the given case. Any ideas guys? Thanks in advance.

1 Like

Hi @Marcusvg

You can follow the below steps to get it done…

  1. You have two data tables dt1 and dt2 and you want to see whether the column contains a particular value that is available in another column in the other dt.

you can use the below logic to get it done

Two for each row loops to loop through the two data tables.
If condition to check whether one dt column contains the value in the other dt

I guess this is what you are looking for right?

Let know whether this works out for you.

If this works, please make sure to mark the answer as the solution as well :slight_smile:


Hi @Lahiru.Fernando,

thank you very much! That’s nearly what i was searching for. But now i have the problem of duplicates in what you call “FinalMatchlist”. Do you know how to avoid that? I tried to count the rows and do a “do while” loop with the condition rowscount < totalrows. But it doesn’t work for me. Do you have any ideas for that?

kind regards,

1 Like

Hi @Marcusvg

Glad to hear from you again… So it looks like you have duplicate records in one of your datatables. To remove duplicates, you can always use the Remove Duplicate Rows activity under DataTable activity list :slight_smile:


It will remove all the duplicate records in the datatable you specify and you are good to go :slight_smile:

Does it help?


Thank you Lahiru! :slight_smile:

1 Like

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