LINQ to left-join datatable DT2 to each datatable in a list of datatables [DT1_1, DT1_2, DT1_3, ..., DT1_k] (where k may vary as an integer nmber of list items)

I have a large data table D2 with a column called “Codes” and I have a list of k data tables DT_list = [D1_1, D1_2, …, D1_k], each of one of which also has a column called “Codes” (which contains a subset of all possible codes specified in D2). I want to append the information in all columns of D2, filtered to include only rows matching the specific codes contained in each of D1_1, D1_2 etc. For example, suppose D1_1.Rows.Field(Of String)(“Codes”) = [A, D, F] then I want to append all columns of D2 for just the rows where D2.Rows.Field(Of String) = [A, D, F]. And similarly for each of the other data tables in the list. I figure a left join of D2 to D1_1 on the “Codes” column will accomplish this without iteration, However, the join data tables activity is not working as expected, so I want to try using LINQ and/or lambda expressions, but despite having watched a plethora of YouTube videos, I am not having success. Can anyone help?

Hi @Dandelbrot ,

Could you maybe provide us with the Sample Input data in the form of Excel Sheets ? A Sheet for D2, and Multiple Sheets for datatables in DT_list. Also, the Expected Output Sheet. We will be able to understand better and suggest you a better solution.

If you are unable to upload files, you could send us Screenshots of the Input data Excel sheets as well.

1 Like