Filter out non matching rows

Can anyone help with an expression : I have 2 datatables(2 excel files - just for testing purposes )and I need to filter out the CustID (63217) that is not present in the other table below.
Table 1: dt_CustomerID Table 2: Out_dtMatchedCustomers

I am using this expression: (From rowCustomerID In in_dtCustomerID.AsEnumerable() From rowCustomers In out_dtMatchedCustomers.AsEnumerable() Where Not rowCustomerID(“Cust ID”).ToString().Contains(rowCustomers(“Customer”).ToString()) Select rowCustomerID).CopyToDataTable()

Hi,

How about the following sample?

arrDr = Out_dtMatchedCustomers.AsEnumerable.Where(Function(r) dt_CustomerID.AsEnumerable.Any(Function(r2) r2("Customer ID").ToString= r("Cust ID").ToString)).ToArray()

Sample
Sample20241120-1.zip (16.7 KB)

Regards,

1 Like

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