vineelag
(vineela27)
August 21, 2023, 1:09am
1
Hi all,
how to add to to data table, number of columns is same but some columns are different but still need to add the data
for ex table1
table 2
Plese let me know how to these two table.
I used to merge activity, due to different column names its not working so please let me know another way.
Hi @vineelag ,
You can join data table
regards,
LNV
1 Like
You can use the join data table activity or else
you can use this lina query to join tables
(From a In Dt1.AsEnumerable()
Join b In Dt2.AsEnumerable()
On a(“name”).ToString Equals b(“name”).ToString
Select Dt3.LoadDataRow (New Object() {
a.Field(Of String)(“name”),
a.Field(Of String)(“class”),
a.Field(Of String)(“City”),
b. Field(Of String)(“name”),
b. Field(Of String)(“age”),
b. Field(Of String)(“city”)
},False)).CopyToDataTable
1 Like
hi @vineelag
can you share the excepted output which you want
i tried using join datatable activity it does not work for me.
Based on your output image, we can try once more.
1 Like
Hey! can u try using append range activty @vineelag
3 Likes
Hey @Shiva_Nikhil ,
You can try using ‘For each row’ for your input file and the ‘add to datarow’ to the output file
1 Like
hi @vineelag
i am sharing the zip file can you look into it
append datatable.zip (8.7 KB)
Hope this helps
1 Like
Athira
(AthiraRoy)
August 21, 2023, 5:01am
11
Please try this,
(From d In dt2.AsEnumerable
Select r = dt1.Rows.Add(d.ItemArray)).CopyToDataTable
Its working for me, note that combined output will be in dt1
1 Like
you can try with LINQ query also
assign activity- you can pass like this
dt1 = dt1.AsEnumerable().Union(dt2.AsEnumerable(), DataRowComparer.Default).CopyToDataTable()
so the out put in dt1
you can try both ways it may help you !
cheers …! @vineelag
1 Like
system
(system)
Closed
August 24, 2023, 5:44am
14
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.