-- 作者:drcaoyf
-- 发布时间:2017/1/23 13:58:00
-- 未将对象引用设置到对象实列
\'首先生成统计表
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表","病历资料")
b.Groups.AddDef("住院日期",DateGroupEnum.Year,"年")
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 Product As String = nd.DataRow("关键字")
Select Case nd.Level
Case 0
nd.Text = nd.text & "年(" & dt.Compute("Sum(数量)","年 = " & Year) & "个)"
Case 1
nd.Text = nd.text & "(" & nd.DataRow("数量") & "个)"
End Select
Next
trv.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(数量)") & "个)",0)
trv.ResumeRedraw 此主题相关图片如下:qq截图20170123135320.jpg
此主题相关图片如下:qq截图20170123135651.jpg
|