第一个问题,统计表是临时表,如果你需要保存成数据表,就先把统计表 导出 ,然后再倒入到狐表。
第二个问题统计如下。
Dim ntb As New DataTableBuilder("统计表") ntb.AddDef("姓名", Gettype(String)) ntb.AddDef("月工作天数", Gettype(Integer)) ntb.AddDef("日平均工资", Gettype(Double)) ntb.Build()
Dim names As List(Of String) = DataTables("工作记录表").GetUniqueValues("姓名 is not null", "姓名") For Each name As String In names Dim filter As String = "姓名 = '" & name & "' And 工作日期 >= #2012-10-01# And 工作日期 <= #2012-10-31#" Dim days As List(Of String) = DataTables("工作记录表").GetUniqueValues(filter, "工作日期") Dim count As Double = DataTables("工作记录表").Compute("Sum(工作总价)", filter) Dim r As Row = Tables("统计表").AddNew() r("姓名") = name r("月工作天数") = days.Count r("日平均工资") = count / days.Count Next MainTable = Tables("统计表")
|