Hi,
I have three columns based on column A i need to join the remaining two columns as shown below.
Column A startpage Endpage
Item 1 1 1
Item 2 3 3
Item 1 4 4
Actual output i want is
Column A Range
Item1 1-1, 4-4
Item2 3-3
Thanks in advance
Regards,
Navya
Yoichi
(Yoichi)
November 19, 2022, 5:25am
3
Hi,
Hope the following sample helps you.
dtResult = dt.AsEnumerable.GroupBy(Function(r) r("Column A").ToString).Select(Function(g) dt.LoadDataRow({g.Key,String.Join(",",g.Select(Function(r) r("startpage").ToString+"-"+r("endpage").ToString))},False)).CopyToDataTable
Sample20221119-1aL.zip (2.8 KB)
Regards,
Gokul001
(Gokul Balaji)
November 19, 2022, 5:30am
4
Hi @Navya_Nadakuduti
How about this expression
(From d In DtBuild.AsEnumerable
Group d By k=d("Column A").toString.Trim Into grp=Group
Let B =String.Join(",",grp.Select(Function (x) x("Start Page").toString.Trim+"-"+x("End Page").toString.Trim))
Let ra = New Object(){k, B}
Select DtClone.Rows.Add(ra)).CopyToDataTable
Check out this XAML file
LinqGroupby.xaml (10.0 KB)
Regards
Gokul
Hi Gokul,
Thank you so much for your solution, code is working as expected.
Best regards,
Navya.
Gokul001
(Gokul Balaji)
November 19, 2022, 7:18am
6
Great @Navya_Nadakuduti
Kindly close this topic by mark as solved. It will help for other too.
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
Regards
Gokul
Hi Yoichi,
Thank you so much for your solution, code is working as expected.
Best regards,
Navya.
1 Like
rajat.jain
(Rajat Jain)
November 19, 2022, 7:42am
8
Kindly put closure to this topic by marking it as solved. It will help for other folks too
Gokul001
(Gokul Balaji)
November 20, 2022, 9:15am
9
Kindly update the correct post as solved @Navya_Nadakuduti
1 Like
system
(system)
Closed
November 23, 2022, 9:15am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.