以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]做了一个带统计的加载,不成功 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185089) |
||||
-- 作者:mengxxaa -- 发布时间:2023/2/3 11:04:00 -- [求助]做了一个带统计的加载,不成功 做了一个带统计的加载,测试不成功,麻烦老师看下代码。 ’生成统计表
Dim g As New SQLGroupTableBuilder("TJB", "订单") g.Groups.AddDef("产品") g.Groups.AddDef("客户") g.Groups.AddDef("雇员") g.Totals.AddDef("_Identify", AggregateEnum.Count, "行数") Dim gt As DataTable = g.Build(False) ’根据统计表生成加载树
Dim dt As DataTable Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "产品|客户|雇员") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim s1 As String = nd.DataRow("产品") Dim s2 As String = nd.DataRow("客户") Dim s3 As String = nd.DataRow("雇员") Select Case nd.Level Case 0 nd.Text = nd.text & "产品(" & dt.Compute("Sum(行数)", "产品 = " & s1) & "条)" Case 1 nd.Text = nd.text & "客户(" & dt.Compute("Sum(行数)", "客户 = " & s1 & " And 客户 = " & s2) & "条)" Case 2 nd.Text = nd.text & "雇员(" & dt.Compute("Sum(行数)", "产品 = " & s1 & " And 客户= " & s2 & " And 雇员 = " & s3) & "条)" End Select Next trv.Nodes.Insert("[加载所有数据]", "加载所有数据(" & Val(dt.Compute("Sum(行数)")) & "条)", 0) trv.ResumeRedraw |
||||
-- 作者:有点蓝 -- 发布时间:2023/2/3 11:23:00 -- 先看看:http://www.foxtable.com/webhelp/topics/1910.htm、http://www.foxtable.com/webhelp/topics/1284.htm |