How to copy one column in DT2 and add in DT1 with values

Hi All,

I want to copy only one column in DT2 and paste in DT1. Can someone please help me in this ?

Note : I don’t want to use for each row …Since I have huge data in datatable

DT1

image

DT2

Expected O/P

@sreejith.ss

Thanks,
Naresh

Hello @Mandava_Naresh

On what basic you want to join these 2 tables? Is there any reference column to consider?

Have you checked the UiPath.Core.Activities.AddDataColumn activity? If not please give it a try.

You will probably not avoid “for each” because copying datacolumn is not possible:

Therefore also the AddDataColumn activity recommended by @Rahul_Unnikrishnan will not work for you.

But you could try “Merge Data Table” instead

Cheers

I tried merge table … It is not working

image

My bad.

Following works:
1/ build DT3 of desired structure
2/ use following statemet to join two source DTs - replace “col1”, “col2” by your column names

DT3 = (From a In dt1.AsEnumerable 
Join b In dt2.AsEnumerable
On dt1.Rows.IndexOf(a) Equals dt2.Rows.IndexOf(b) 
Select dt3.LoadDataRow(New Object() {
	a("col1"),
	b("col2")},
	False)
).CopyToDataTable

Cheers

here you are
CopyColumnFromeOneDTtoAnotherDT.xaml (17.1 KB)

Thank you very much @J0ska

Another way for you. You must delete duplicate row in table to received final table.
Add column.zip (104.0 KB)

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