以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 请老师修改目录树代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93758) |
-- 作者:jamhuton -- 发布时间:2016/12/6 14:24:00 -- 请老师修改目录树代码 Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("流水账RMB")) b.Groups.AddDef("交易账户") b.Groups.AddDef("日期",DateGroupEnum.Year,"年") b.Groups.AddDef("日期",DateGroupEnum.Month,"月") b.Totals.AddDef("交易账户",AggregateEnum.Count,"订单数") \'根据客户列来统计记录数,也就是订单数 dt = b.Build \'参数设置为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 Product As String = nd.DataRow("交易账户") Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Select Case nd.Level Case 0 nd.Text = nd.text & "(" & nd.DataRow("订单数") & "票)" Case 1 nd.Text = nd.text & "年(" & dt.Compute("Sum(订单数)","年 = " & Year) & "票)" Case 2 nd.Text = nd.text & "月(" & dt.Compute("Sum(订单数)","年 = " & Year & " And 月 = " & Month) & "票)" End Select Next trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(订单数)") & "票)",0) trv.ResumeRedraw |
-- 作者:有点蓝 -- 发布时间:2016/12/6 14:38:00 -- Select Case nd.Level Case 0 nd.Text = nd.text & "(" & dt.Compute("Sum(订单数)","交易账户 = \'" & Product & "") & "票)" Case 1 nd.Text = nd.text & "年(" & dt.Compute("Sum(订单数)","交易账户 = \'" & Product & "\' and 年 = " & Year) & "票)" Case 2 nd.Text = nd.text & "月(" & dt.Compute("Sum(订单数)","交易账户 = \'" & Product & "\' and 年 = " & Year & " And 月 = " & Month) & "票)" End Select
|
-- 作者:有点色 -- 发布时间:2016/12/6 14:38:00 -- Case 0 nd.Text = nd.text & "(" & nd.DataRow("订单数") & "票)"
改成
Case 0 nd.Text = nd.text & "(" & dt.Compute("Sum(订单数)","交易账户 = \'" & Product & "\'") & "票)"
|
-- 作者:jamhuton -- 发布时间:2016/12/6 15:14:00 -- .NET Framework 版本:2.0.50727.8669 Foxtable 版本:2016.7.29.1 错误所在事件:窗口,流水账,AfterLoad 详细错误信息: 表达式包含无效的字符串常量: \'货代交行9610RMB。
|
-- 作者:有点蓝 -- 发布时间:2016/12/6 15:16:00 -- 少一个单引号,补上 nd.Text = nd.text & "(" & dt.Compute("Sum(订单数)","交易账户 = \'" & Product & "\'") & "票)"
|
-- 作者:jamhuton -- 发布时间:2016/12/6 15:19:00 -- 谢谢老师,可以了 |