Date table comparison

Hi all

I am stuck in a] problem…

I have two data tables, one contains the names, another datatable contains another set of names, i just need to check if the name in dt1 is present in dt2.


Typically, you should say your logic out loud, then translate that into the activities that are provided.

“I want to go through each row in dt1, and go through each row in dt2, then check IF the names are equal”

So to translate this into activities:

For each row1 in dt1
    assign Boolean Type Variable to False //for initialization
    For each row2 in dt2
        If row1(0).ToString.Trim = row2(0).ToString.Trim
            assign Boolean Type Variable to True
    If booleanVariable
        <perform actions>

However, the logic with this method can sometimes get cluttered and confusing to the eye.

You can also consider some query code which is more efficient.

For each row1 in dt1
    If dt2.AsEnumerable.Where(Function(row2) row2(0).ToString.Trim = row1(0).ToString.Trim ).ToArray.Count > 0
        <perform actions>


Hi ClaytonM,

I tried out your logic, but getting error, could you please check the below xaml file and let me knowMain.xaml (28.2 KB)
testsheet1.xlsx (12.1 KB)
testsheet2.xlsx (306.3 KB)

i have uploaded testsheet 1 and testsheet 2,

i want to check if the name frm sheet1_is present in sheet2. if it is present, it should display yes or else No

row1.ToString.Trim = row2.ToString.Trim
Could you check this one


Nope im still not getting the result,

I want every value of sheet 1 to be compared with Sheet 2

Main.xaml (28.9 KB)


You are comparing data rows here:

So to compare the items in the row you need the column index or name. Since you are building the values into a 1 column Table, you could select to just use the 0 index. Like so:
You can also use the column name if you want as a string in the parenthesis.

Also, briefly looking over your workflow, I don’t see any issues other than that. So what was the error you are getting? Can you provide a screenshot or the error message and which activity?

Thanks and Regards.

Thanks Clayton! It worked :slight_smile: