VLOOKUP in 2 data tables

DataTable 1 :

image

DataTable 2 ( VIP User List)

image

How to do VLOOKUP in 2 data tables?

We need look for VIP user in the datatable2, if the user present in datatable1 is available in Datatable2 then update the vip user name in “C” column in datatable1 else update as “N/A”?

Hi @Sathish_Kumar_S

DT1 = Datatable 1
DT2 = Datatable 2

1.Use For each row for DT1
2.Inside For each row use “Update Row item” activity
Value : If(DT2.Select(“[VIP User List]='”+CurrentRowDT1(“User”).ToString.Trim+“'”).Count>0,
CurrentRowDT1(“User”).ToString,
“NA”)
Row : CurrentRowDT1
Column : Select “Name”. Value of the column name will be “VIP user”

Thanks!

@Umadevi_Sanjeevi Thank you for your quick response.

Getting attached error … The VIP1 is user name not the column

As an alternate, we can do the following: HashSet LookUp Approach

Vars:
grafik

Flow:

myLookUpHashSet =
new HashSet(Of String) (dt2.AsEnumerable.Select(Function (x) x("Column1").toString.Trim))
dt2.AsEnumerable.Select(Function (x) x("Column1").toString.Trim).ToHashSet()

row(“isMatch”) =
If(myLookUpHashSet.Contains(row("Column1").toString.Trim), row("Column1"),"NA")

Traces:
grafik

After update:
grafik

We evolved from LKDictionary to HashSet as we avoided the unneeded values from the keyValuePairs

1 Like

Hi @Sathish_Kumar_S ,

Have got output . pls refer this xaml

DT1
image

DT2:
image

Output:

User Type VIP user
AABS Dialog AABS
BBSA Dialog BBSA
BBSAAAA Dialog NA

Test.xaml (13.3 KB)

Thanks!

1 Like

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