\'\'\'
Dim cn As String = "gp99" \'sql外部数据源
Dim bm As String = "统计表1"
Dim b As New SQLGroupTableBuilder(bm,"批量预测")
b.ConnectionName = cn
b.Groups.AddDef("日期",DateGroupEnum.Month,"月份") \'根据产品分组
b.Groups.AddDef("日期",DateGroupEnum.none) \'根据产品分组
b.Groups.AddDef("牛熊") \'根据分组
b.Totals.AddDef("牛熊",AggregateEnum.Count,"涨跌次数")
b.Totals.AddDef("预测涨跌幅") \'对数量进行统计
b.Build \'生成统计表
Tables("批量选股_Table10").DataSource = b.BuildDataSource()
Dim dt As Table = Tables("批量选股_Table10")
Dim g As Subtotalgroup
dt.SubtotalGroups.Clear()
\'定义分组
g = New Subtotalgroup
g.GroupOn = "月份"
g.TotalOn = "牛熊,预测涨跌幅,涨跌次数"
dt.SubtotalGroups.Add(g)
dt.Subtotal() \'生成汇总模式
dt.GroupAboveData = True \'分组行位于数据行之上
dt .TreeVisible = True \'显示目录树
With Tables("批量选股_Table10") \'合并
.MergeMode = MergeModeEnum.Standard \'标准合并模式
.MergeCols.Clear() \'清除原来的合并列
Dim Names As String() = {"月份","日期","牛熊"}
For i As Integer = 0 To Names.Length -1
.MergeCols.Add(Names(i))
Next
.AllowMerge = True \'启用合并模式
End With