DTwithDuplicates.AsEnumerable().GroupBy(function(x) {x(“Product Name”).ToString, x(“Product ID”).ToString}).Select(function(g) g.CopyToDataTable)
Trying above expression and assigning to variable of <IEnumerable>
But its not working as intended and giving below output:
@Yoichi @loginerror @Pablito
Yoichi
(Yoichi)
May 17, 2021, 2:19pm
2
Hi,
Can you try the following expression?
DTwithDuplicates.AsEnumerable.GroupBy(Function(r) Tuple.Create(r("Product Name").ToString, r("Product ID").ToString)).Select(Function(g) g.CopyToDataTable).ToList
Regards,
1 Like
@Yoichi : great Thanks a lot it works
Is there a Linq way to created derived column let say amount = Price*QTY from existing 2 columns Price and QTY without iterating for loop.
Thanks in advance
ppr
(Peter Preuss)
May 17, 2021, 3:21pm
5
in that case we often can use the expression property of a datacolumn
1 Like
system
(system)
Closed
May 20, 2021, 4:48pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.