以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  目录树问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=192201)

--  作者:15666282205
--  发布时间:2024/6/3 9:14:00
--  目录树问题
老师,我设计了带统计的目录树,但是数据量大了以后启动很慢,我想把统计功能去掉,麻烦您帮忙看看怎么改代码
\'\'---------------------------------设置工艺卡筛选树(按日期显示)--------------------------------------------
\'\'首先生成统计表
Dim dt8 As DataTable
Dim b8 As New sqlGroupTableBuilder("统计表零件目录","零件目录表")
b8.C
b8.Groups.AddDef("日期",DateGroupEnum.Year,"年")
b8.Groups.AddDef("日期",DateGroupEnum.Month,"月")
b8.Groups.AddDef("日期",DateGroupEnum.day,"日")
b8.Groups.AddDef("零件序号")
b8.Totals.AddDef("零件序号",AggregateEnum.Count,"次数") \'根据客户列来统计记录数,也就是订单数
dt8 = b8.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示
\'然后根据统计表生成目录树
Dim trv8 As WinForm.TreeView = e.Form.Controls("TreeView2")
trv8.BuildTree(dt8, "年|月|日|零件序号")
trv8.StopRedraw
For Each nd As WinForm.TreeNode In trv8.AllNodes
    Dim Year As Integer = nd.DataRow("年")
    Dim Month As Integer = nd.DataRow("月")
    Dim day As Integer = nd.DataRow("日")
    Dim Product5 As String = nd.DataRow("零件序号")
        Select Case nd.Level
        Case 0
            nd.Text = nd.text & "年(" & dt8.Compute("Sum(次数)","年 = " & Year) & ")"
        Case 1
            nd.Text = nd.text & "月(" & dt8.Compute("Sum(次数)","年 = " & Year & " And 月 = " & Month) & ")"
        Case 2
            nd.Text = nd.text & "日(" & dt8.Compute("Sum(次数)","年 = " & Year & " And 月 = " & Month & " and 日 = " & day) & ")"
        Case 3
            nd.Text = nd.text & "#(" & dt8.Compute("Sum(次数)","年 = " & Year & " And 月 = " & Month & " and 日 = " & day & " And  零件序号 = \'" & nd.Text & "\'") & ")"
           
        Case 4
            nd.Text = nd.text & "(" & nd.DataRow("次数") & ")"
    End Select
Next
trv8.Nodes.Insert("所有行","所有行(" & dt8.Compute("Sum(次数)") & ")",0)
trv8.ResumeRedraw

[此贴子已经被作者于2024/6/3 9:14:24编辑过]

--  作者:有点蓝
--  发布时间:2024/6/3 13:57:00
--  
trv8.BuildTree(dt8, "年|月|日|零件序号")这一句之后的代码全部去掉