Foxtable(狐表)用户栏目专家坐堂 → 目录树节点都已经正常生成了,可单击到第四个节点就出现错误提示了


  共有2427人关注过本帖树形打印复制链接

主题:目录树节点都已经正常生成了,可单击到第四个节点就出现错误提示了

美女呀,离线,留言给我吧!
lfz
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:49 积分:494 威望:0 精华:0 注册:2021/11/16 13:45:00
目录树节点都已经正常生成了,可单击到第四个节点就出现错误提示了  发帖心情 Post By:2023/6/30 11:20:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20230630111626.png
图片点击可在新窗口打开查看

 

目录树节点都已经正常生成了,可单击到第四个节点就出现错误提示了

Dim Filter As String = ""
If e.Node.Name <> "加载所有行" Then '要用Name属性,不能用Text属性
    Dim jc As String = e.Node.DataRow("fa piao类型")
    Dim nm As String = e.Node.DataRow("开piao单位简称")
    Dim y As Integer = e.Node.DataRow("认证年份")
    Dim m As Integer = e.Node.DataRow("认证月份")
    Dim Year As Integer = e.Node.DataRow("年")
    Dim month As Integer = e.Node.DataRow("月")
    Dim day As Integer = e.Node.DataRow("日")
    Select Case e.Node.Level
        Case 0
            filter = "fa piao类型 = '"& jc & "'"
        Case 1
            filter = "fa piao类型 = '" & jc & "' And 开piao单位简称 = '" & nm & "'"
        Case 2
            filter = "fa piao类型 = '" & jc & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = " & y
        Case 3
            filter = "fa piao类型 = '" & jc & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = " & y & " and 认证月份 = " & m
        Case 4
            filter = "fa piao类型 = '" & jc & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = " & y & " and 认证月份 = " & m & " And 年 = " & year
        Case 5
            filter = "fa piao类型 = '" & jc & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = " & y & " and 认证月份 = " & m & " And 年 = " & year & " And 月 = " & month
        Case 6
            filter = "fa piao类型 = '" & jc & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year & " And 月 = " & month & "and 日 = " & day
    End Select
End If

DataTables("进项fa piao").loadFilter = Filter
DataTables("进项fa piao").load()

 

节点设置如下:

    Select Case nd.Level
        Case 0
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'") & "份)"        
        Case 1
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'") & "份)"
        Case 2
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'And 认证年份 = " & y ) & "份)"
      
        Case 3
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'And 认证年份 = " & y & "and 认证月份 = " & m ) & "份)"
        Case 4
            Dim Filter As String  = " fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'and 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
        Case 5
            Dim Filter As String = "fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'and 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year & " And 月 = " & month
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
        Case 6
            Dim Filter As String = "fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'and 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year & " And 月 = " & month & " and 日 = " & day
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
           
    End Select

 


 


 回到顶部
美女呀,离线,留言给我吧!
lfz
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:49 积分:494 威望:0 精华:0 注册:2021/11/16 13:45:00
  发帖心情 Post By:2023/6/30 12:01:00 [显示全部帖子]

至少有一个参数没有指定值,在截图里面有,哪一段代码我也圈出来了

 回到顶部
美女呀,离线,留言给我吧!
lfz
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:49 积分:494 威望:0 精华:0 注册:2021/11/16 13:45:00
回复:(有点蓝)应该是合并的条件有问题:  &nb...  发帖心情 Post By:2023/6/30 13:41:00 [显示全部帖子]

是的,都是整数列

 


图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20230630133712.png
图片点击可在新窗口打开查看

生成目录树节点代码正常显示,如下

Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表1","进项fa piao")
b.C
b.Groups.AddDef("fa piao类型")
b.Groups.AddDef("开piao单位简称")
b.Groups.AddDef("认证年份")
b.Groups.AddDef("认证月份")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Day,"日")
b.Totals.AddDef("认证年份",AggregateEnum.Count,"份数") '根据客户列来统计记录数,也就是订单数
dt = b.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
trv1.BuildTree(dt, "fa piao类型|开piao单位简称|认证年份|认证月份|年|月|日","","fa piao类型,开piao单位简称,认证年份,认证月份,年,月,日")

trv1.StopRedraw
For Each nd As WinForm.TreeNode In trv1.AllNodes
    Dim lx As String = nd.DataRow("fa piao类型")
    Dim nm As String = nd.DataRow("开piao单位简称")
    Dim Y As Integer = nd.DataRow("认证年份")
    Dim M As Integer = nd.DataRow("认证月份")
   
    Dim year As Integer = nd.DataRow("年")
    Dim month As Integer = nd.DataRow("月")
    Dim day As Integer = nd.DataRow("日")

   
    Select Case nd.Level
        Case 0
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'") & "份)"        
        Case 1
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'") & "份)"
        Case 2
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'And 认证年份 = " & y ) & "份)"
      
        Case 3
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'And 认证年份 = " & y & "and 认证月份 = " & m ) & "份)"
        Case 4
            Dim Filter As String  = " fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'and 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
        Case 5
            Dim Filter As String = "fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'and 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year & " And 月 = " & month
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
        Case 6
            Dim Filter As String = "fa piao类型 = '" & lx & "'and 开piao单位简称 = '" & nm & "'and 认证年份 = " & y & "and 认证月份 = " & m & " And 年 = " & year & " And 月 = " & month & " and 日 = " & day
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
           
    End Select
Next
trv1.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(份数)") & "条)",0)
trv1.ResumeRedraw


 回到顶部