Find a value from a table where two different tables have the same value

Hi
I have these 2 tables:
I need the rowNo (from the first table) of the matching Customer = custID

image

Can someone help with LINQ
Thanks

@chauhan.rachita30

As it is on excel better to directly use a look up activity which will give you the excel row details directly

Cheers

Hİ, @chauhan.rachita30

It can be help to you;

Hello @chauhan.rachita30

You could read the two files into a datatable.
Then iterate the first one and use the “Lookup Data Tabel” activity to search for Customer based on Cust ID.

Take a look at the example below:


Lookup datatable.xaml (12.0 KB)

Regards
Soren

You can use LINQ to find matching entries between the two tables. For example, if both tables have a common column (e.g., “ID” or “Name”), you can use this LINQ query:

matchingRows = (From row1 In dt1.AsEnumerable()
Join row2 In dt2.AsEnumerable()
On row1(“ColumnName”).ToString() Equals row2(“ColumnName”).ToString()
Select row1).CopyToDataTable()

This will return all the rows from dt1 where a match is found in dt2 based on the specified column.

If you’re using the Join Data Tables activity, you can configure it to perform an inner join between the two tables:

  1. Use the Join Data Tables activity.
  2. Set dt1 and dt2 as the inputs.
  3. Specify the column from both tables that you want to match.
  4. Choose “Inner” as the join type to only get the rows that exist in both tables.

This will output a new data table containing the rows where the values from the specified columns in dt1 and dt2 match.

@chauhan.rachita30 try this method hope it work for you there i’m using join datatable

Cheers