GuhanTM
(GuhanTM)
May 22, 2020, 2:04pm
1
I need to append two datatables “DT1” & “DT2”
DT1:
Column1 Column2
A 1
B 2
C 3
D 4
DT2:
Column1 Column2
E 5
F 6
G 7
H 8
What I need in DT1 after merged:
DT1:
Column1 Column2
A 1
B 2
C 3
D 4
E 5
F 6
G 7
H 8
We can get the above result by using Merge Datatable activity. But I need to solve this in LinQ Query instead of using Merge Datatable activity.
Please help me
1 Like
ppr
(Peter Preuss)
May 22, 2020, 2:17pm
2
@GuhanTM
In General IT can be understood as a dateset Operation of the Type Union.
With a linq give a try on Following
(From d in dt2.asenumerable
Let ra = d.itemarray
Select dt1.rows.add(ra)).copytodatatable
Assign this return to a variable dtTemp of datatype Datatable.
Inspect dt1 for the added rows
2 Likes
GuhanTM
(GuhanTM)
May 22, 2020, 2:34pm
3
Thanks for the reply @ppr .
The code is not appending the dt2 table values.
dt1 is having dt2 contents only. Please help
ppr
(Peter Preuss)
May 22, 2020, 2:48pm
4
Can you Share your Statements with me thanks.
Kindl Note. The dumpout to dtTemp Shows the appended rows. Dt1 has to Show all rows
GuhanTM
(GuhanTM)
May 22, 2020, 6:04pm
5
Please find the file.AppendDT.xaml (8.9 KB)
ppr
(Peter Preuss)
May 22, 2020, 6:47pm
6
@GuhanTM
Unfortunately im Off from Laptop / UiPath till monday. All my Post since Yesterday i was writing in Cellphone. In Case of you can not wait so Long so Just Put the statements Here in the Posts. I guess it is a minimal Thing aß this technique was used very often by me and worked
GuhanTM
(GuhanTM)
May 22, 2020, 7:03pm
7
@ppr No Issues and I will wait.
And again Thanks for the reply
ppr
(Peter Preuss)
May 24, 2020, 9:10pm
8
@GuhanTM
Find starter help here:
AppendDataTableOnDataTable.xaml (8.7 KB)
I did the prototype with a smaller dataset but it was running with the statement from the post.
dtTemp: only the added rows
dt1 on end: dt1 and appended dt2 rows
2 Likes
GuhanTM
(GuhanTM)
May 27, 2020, 11:57am
9
@ppr Thanks for the solution. I will ignore the dtTemp.
Works good.
system
(system)
Closed
May 30, 2020, 11:57am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.