弄个窗口表:
Dim t As Table = Tables("订单")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "产品"
g.TotalOn = "数量"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
t.Subtotal()
Dim r As Row
Tables(e.Form.Name & "_Table1").DataTable.DataRows.Clear()
For i As Integer = 0 To t.Rows.Count(True) - 1
r = t.Rows(i,True)
If r.IsGroup Then
Dim nr As Row = Tables(e.Form.Name & "_Table1").AddNew()
nr("第一列") = r("产品")
nr("第二列") = r("数量")
End If
Next
Tables(e.Form.Name & "_Table1").Sort = "第二列"