分组统计之截止统计

前面已经讲到分组统计的时候,在Totals集合中添加一个统计列的语法如下: 

Totals.AddDef(Name)
Totals.AddDef(Name, NewName)
Totals.AddDef(Name, NewName, NewCaption)
Totals.AddDef(Name, Aggregate)
Totals.AddDef(Name, Aggregate, NewName)
Totals.AddDef(Name, Aggregate, NewName, NewCaption)

如果要进行截止统计,只需在上述语法后面,加上一个参数True:

Totals.AddDef(Name, True)
Totals.AddDef(Name, NewName, True)
Totals.AddDef(Name, NewName, NewCaption, True)
Totals.AddDef(Name, Aggregate, True)
Totals.AddDef(Name, Aggregate, NewName, True)
Totals.AddDef(Name, Aggregate, NewName, NewCaption, True)

示例

统计每月销售数量以及截止到该月的累计销售数量:

Dim g As New GroupTableBuilder("统计表1", DataTables("订单"))
g
.Groups.AddDef("日期", "月")
g
.Totals.AddDef("数量","小计")
g
.Totals.AddDef("数量", "累计", True)
g
.Build()
MainTable
= Tables("统计表1")

得到的统计结果为:

 

 

 


本页地址:http://www.foxtable.com/webhelp/topics/2645.htm