How to join two data table based on particular column

Hi Team,

I want to join two data table based on XX no(column), that column is unique , please help me anyone for this.

Input excel 1:
image

Input excel 2:
image

Expected output:
image

Regards,
Raja G

1 Like

hI @Raja.G

Checkout this video

Regards
Sudharsan

1 Like

Hi @Raja.G

Check out this Tutorial

Regards
Gokul

Hi @Raja.G

How about this expression?

(From data1 In Dt1.AsEnumerable()
Join data2 In Dt2.AsEnumerable()
On data1("XX no") Equals data2("XX no")
Select DtClone.Rows.Add({
data2("XX no"),data1("Name"),data2("Status"),data2("Comment"),data2("Date")})).copytodatatable

Check out the XAML file

TwoDTJoinDataTable.xaml (12.4 KB)

Output

image

Hope it will helps

Regards
Gokul

3 Likes

Hi @Gokul001 ,

I dont want seperate datatable , i want to join datatable1(Excel1) and datatable2(Excel2) in output for datatable1(excel1)

please help me for this.

Input excel 1:
image

Input excel 2:
image

Output:
input excel 1:
image

You can use this expression as the output for datatable1(excel1) @Raja.G

@Gokul001 ,

Input data table(excel 1) no need to change anything ,just joint 2nd data table based on XX no

dont want clone data table, i need to update xx no status for excel 1, whatever xx no present in excel1 i want update excel2 xx no status to excel 1 xx no

Based on xx no join two table excel 1 status not there so i want update excel 1 status to get from excel 2

@supermanPunch

please help me for this

1 Like

I didn’t clone the Data table @Raja.G . Just Create the dummy DataTable and Update the value in the table. For that we need to use like that way.

Check out the XAML file

Based on the Input and Expected Output I have Create LINQ expression

Regards
Gokul

@Gokul001 ,

input 1:
image

input 2:
image

output:- I want output :Input 1
image

Hi @Raja.G ,

Have you tried with Join Datatables Activity ? Configure as below and let us know if you are able to get the output or any different output resulted.
image

Here DT1 is the Datatable that you want to Update.

We would have to remove the XX no_1 column from the resulting Datatable (DT1) after the operation is performed/ Just Check in the Debug Panel after the Join to get an idea on the Column to be removed.

2 Likes

HI @Raja.G

Check out the XAML file

TwoDTJoinDataTable.xaml (16.0 KB)

image

Regards
Gokul

2 Likes

@Gokul001 , @supermanPunch Thanks guys

2 Likes

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