以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]生成带统计的筛选树时,月份出现重复 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=60688) |
||||
-- 作者:ehomecd -- 发布时间:2014/11/29 10:17:00 -- [求助]生成带统计的筛选树时,月份出现重复 生成带统计的筛选树时,月份出现重复
抄的帮助里的代码,帮助地址:http://www.foxtable.com/help/topics/2741.htm \'首先生成统计表 Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("收文登记")) b.Groups.AddDef("收到时间",DateGroupEnum.Year,"年") b.Groups.AddDef("收到时间",DateGroupEnum.Month,"月") b.Groups.AddDef("来文机关") b.Totals.AddDef("编号",AggregateEnum.Count,"记录数") \'根据客户列来统计记录数,也就是订单数 dt = b.Build(False) \'参数设置为False,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "年|月|来文机关",,"年 desc") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim lwjg As String = nd.DataRow("来文机关") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(记录数)","年 = " & Year) & "条)" Case 1 nd.Text = nd.text & "月(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 月 = " & Month) & "条)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("记录数") & "条)" End Select Next trv.Nodes.Insert("显示所有记录","显示所有记录(" & dt.Compute("Sum(记录数)") & "条)",0) trv.ResumeRedraw 高手看看哪里有问题? [此贴子已经被作者于2014-11-29 10:59:32编辑过]
|
||||
-- 作者:Bin -- 发布时间:2014/11/29 10:41:00 -- 把文件发上来 |
||||
-- 作者:ehomecd -- 发布时间:2014/11/29 11:00:00 -- 附件已上传 |
||||
-- 作者:czy -- 发布时间:2014/11/29 14:36:00 -- Tables("收文登记").ExtendLastCol = True Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("收文登记")) b.Groups.AddDef("收到时间",DateGroupEnum.Year,"年") b.Groups.AddDef("收到时间",DateGroupEnum.Month,"月") b.Groups.AddDef("来文机关") b.Totals.AddDef("编号",AggregateEnum.Count,"记录数") \'根据客户列来统计记录数,也就是订单数 dt = b.Build(False) \'参数设置为False,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = Forms("收文检索").Controls("TreeView1") trv.BuildTree(dt, "年|月|来文机关","","年,月 desc") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim lwjg As String = nd.DataRow("来文机关") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(记录数)","年 = " & Year) & "条)" Case 1 nd.Text = nd.text & "月(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 月 = " & Month) & "条)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("记录数") & "条)" End Select Next trv.Nodes.Insert("显示所有记录","显示所有记录(" & dt.Compute("Sum(记录数)") & "条)",0) trv.ResumeRedraw |