How to join two datatables using LINQ with identity column and it should select only specific columns from both datatable and it should not null value to merge while we match identity column

while joining two tables with identity column username it should allow null values as shown in output screenshot

Do you need in particular only LINQ query?

Because we already have one activity which does your requirement. Please have a look -

Karthik Byggari

Hi @Aravinthan

Try this J


Iam using 2018.2.6 only Join Datatable activity is missing so iam trying with linq. I have tried updating uipath.core.Activities also but no use. Kindly help must be helpful.

@Aravinthan hi, first build datatable with column using(build datatable activity) and assign that table with value

(From a In DT1.Select()
Join b In DT2.Select()
On a(“Name”).ToString Equals b(“Name”).ToString
Select dt5.LoadDataRow (New Object() {
a.Field(Of String)(“Name”),
a.Field(Of String)(“City”),
a.Field(Of String)(“Country”),
b.Field(Of Double)(“ProjectID”)},False)).CopyToDataTable()

HI!.As YOu can see in Datatable 1 and Datatable2 syntax of word “Srini” (“srini”) is different.
Is it possible to use LINQ for joining that kind of data’s ???
Or using als condition another keyword than EQUALS?
If you have another example - i will be very appreciate.
Thank you !

Handling such minor differences e.g. can be done with toUpper
e.g. On a(“Name”).ToString.toUpper Equals b(“Name”).ToString.toUpper

Join and especially the ON clause has defined some strict construct (e.g. leftside EQUALS rightside)

In some cases a cartesian Product can be used, but has also Cons and Pros

1 Like

Is it possible to make these Manipulations ( toUpper etc) within JoinDatatable activity???
p.s. by example i would like to make join 2 tables where Name in Table1 is substr(1,10) ( by example) of Name in table 2. Something like "MarynaShubna_the_Queen " and “MarynaShubna”.
Thank you in Advance

toUpper as mentioned is possible
Your case with the name should be possible as well

Someting like
(From a In DT1.Select()
Join b In DT2.Select()
On a(“Name”).ToString.trim.substr(1,10) Equals b(“Name”).ToString.trim
… rest of statement

I didnt count the length of the name, substring start index is 0 etc. so statement is for showcasing only

1 Like

YES ! I Understand YOU ! Thank you VERY much!!!

You’re welcome - Happy automation :slight_smile: