Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表3","资产总表")
b.C
b.Groups.AddDef("采购信息_购买时间",DateGroupEnum.Year,"年")
b.Groups.AddDef("采购信息_购买时间",DateGroupEnum.Quarter ,"季度")
b.Groups.AddDef("地点")
b.Groups.AddDef("部门")
b.Groups.AddDef("资产类型")
b.Totals.AddDef("_Identify",AggregateEnum.Count,"设备数")
dt = b.Build(False) '参数设置为False,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "资产类型|地点|部门")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim Year As Integer = nd.DataRow("年")
Dim Quarter As Integer = nd.DataRow("季度")
Dim Count As String = nd.DataRow("设备数")
Dim place As String = nd.DataRow("地点")
Dim part As String = nd.DataRow("部门")
Dim lx As String = nd.DataRow("资产类型")
'msgbox(nd.text)
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & dt.Compute("Sum(设备数)","资产类型 = " & lx) & "台)"
End Select
Next
trv.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(设备数)") & "台)",0)
trv.ResumeRedraw
黄色部分的代码好像有问题。提示找不到 某某列