【其他-Uipath】VB语法操作DataTable分组并求和
需要对DataTable分组求和的语法:VB.net 和C#中还有点不太一样。最后试了好多方法,要这么写
我的dataTabel数据:
1 (From p In dataTabel.AsEnumerable() 2 Group By x= New With { Key.a =p.Item("name")} Into Grp = Group Select dataTabel.Clone.LoadDataRow (New Object() 3 {grp(0)(0),grp.Sum(Function ( r ) 4 if(String.IsNullOrEmpty(r("fen").ToString) 5 or String.IsNullOrWhiteSpace(r("fen").ToString),0,Convert.ToDouble(r("fen").ToString)))},False)).CopyToDataTable
最后成功打印: