(From r In DT.AsEnumerable
Group By k = r(“ID”).ToString, a =r(“Type”).ToString Into grp = Group
Let ra =New Object(){k,a,grp.Sum(Function(x)CDbl(x(“Value”).ToString)),String.Join(“,”,grp.Select(Function(x)x(“Date”).ToString).ToArray),grp(0)(“Name”).ToString}
Select OutputDT.Rows.Add(ra)).CopyToDatatable can someone explain this code what is DT and outputDT
DT would be the data table you are using in this code, and outputDT is the data table that you will be storing the output of the query in
for example if I have InputDT as the DT to plug into the query and then outputDT
But I am getting as object reference not found
Can you please show screenshot
Can you please share xaml file with this code
Can you show me your code so I can see where the issue is
I have a datatable as
A. B. C. D
123 A. 10.00 request1
123 A. 10.00 request1
Output should be
A. B. C. D
123 A 20.00 request1
Since column A and B are same need to append it
I have used the above query
But I got the output as
A. B. C. D
123 A. 40. request1
Hi @sruthesanju
Can you try replacing sum of c column with this
String.Join(“||”,grp.Where(Function(x) Not x(“Value”).ToString.Contains(“||”)).
Select(Function(x) x(“Value”).ToString)).Split({“||”},StringSplitOptions.None).Take(CInt(String.Join(“||”,grp.Where(Function(x) Not x(“Value”).ToString.Contains(“||”)).
Select(Function(x) x(“Value”).ToString)).Split({“||”},StringSplitOptions.None).Count-1)).Sum(Function(x) CInt(x.ToString))
Cheers