LINQ LEFT JOIN AND RIGHT JOIN

Hi,

I badly need help to implement left join and right joins to my linq query, however join only causes unexpected results.

Here’s my code:

(From a In dtLTConcat
Join b In dtSTConcat On b(“Concat PL”).ToString Equals a(“Concat PL”).ToString
Join c In dtZEDLConcat On a(“Concat PL”).ToString Equals c(“Concat PL”).ToString
Join d In dtPPConcat On a(“Concat PP”).ToString Equals d(“Concat PP”).ToString
Select dtPriceUpdate.LoadDataRow(New Object(){
a(“Client”).ToString,
a(“Application”).ToString,
a(“Condition type”).ToString,
a(“Sales Org#”).ToString,
a(“Distr# Channel”).ToString,
a(“Price List”).ToString,
a(“Article”).ToString,
a(“Sales unit”).ToString,
a(“Concat PP”).ToString,
a(“Valid to”).ToString,
a(“Valid From”).ToString,
a(“Cond#record”).ToString,
a(“Concat PL”).ToString.ToString,
a(“LT VKP0”).ToString,
a(“LT Unit”).ToString,
(CDbl(a(“LT VKP0”).ToString) / CInt(a(“LT Unit”).ToString)).ToString,
c(“Valid to”).ToString,
c(“Valid From”).ToString,
c(“ZEDL”).ToString,
c(“ZEDL per”).ToString,
(CDbl(c(“ZEDL”).ToString) / CInt(c(“ZEDL per”).ToString)).ToString,
b(“Valid to”).ToString,
b(“Valid From”).ToString,
b(“ST VKP0”).ToString,
b(“ST Unit”).ToString,
(CDbl(b(“ST VKP0”).ToString) / CInt(b(“ST Unit”).ToString)).ToString,
d(“P Rt Amt”).ToString,
d(“P Rt Per”).ToString,
(CDbl(d(“P Rt Amt”).ToString) / CInt(d(“P Rt Per”).ToString)).ToString,
d(“Rt UOM”).ToString,
d(“Site Grp”).ToString,
d(“Status”).ToString,
d(“Cp Tp”).ToString}, False)).CopyToDataTable

Now in joining this is what I want:

(From a In dtLTConcat
Join b In dtSTConcat On b(“Concat PL”).ToString Equals a(“Concat PL”).ToString => THIS SHOULD BE RIGHTJOIN
Join c In dtZEDLConcat On a(“Concat PL”).ToString Equals c(“Concat PL”).ToString => THIS SHOULD BE LEFT JOIN
Join d In dtPPConcat On a(“Concat PP”).ToString Equals d(“Concat PP”).ToString => THIS SHOULD BE LEFT JOIN

What to do?

Hi @dhennespiritu

Could you clarify what you are trying to achieve and why using our Data table activities is not an option?

There is no right join in datatable activities

There isn’t a “Right Join” in the Join DataTable Activity , but you can switch the Datatable variables to achieve that.
Suppose you wish to find the Right Join of Dt1 and Dt2, then the solution is:
Input DataTable 1: Dt2
Input DataTable 2: Dt1
Sometimes we tend to become too technical in our approach, and fail to see the simple workarounds that are laid bare in front of us.
I hope this helps!

1 Like