以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  另一种通用筛选树 拼接筛选条件 拼接字符串  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153294)

--  作者:nxhylczh
--  发布时间:2020/8/6 11:59:00
--  另一种通用筛选树 拼接筛选条件 拼接字符串

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

老师  像这种目录树如何接接成筛选条件呢?

--  作者:有点蓝
--  发布时间:2020/8/6 12:19:00
--  
参考:http://www.foxtable.com/webhelp/topics/2503.htm
--  作者:shenyl0211
--  发布时间:2020/8/6 12:35:00
--  
我还以为是楼主的分享呢,原来是徒有虚名的“通用筛选树”
--  作者:nxhylczh
--  发布时间:2020/8/6 12:53:00
--  
我看了NN遍了,还是不会!
--  作者:nxhylczh
--  发布时间:2020/8/6 13:03:00
--  
在线坐等 。。。。。。。
--  作者:有点蓝
--  发布时间:2020/8/6 13:36:00
--  
什么地方不会,有什么问题。请贴出代码,描述具体问题。http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=150626
--  作者:nxhylczh
--  发布时间:2020/8/6 16:03:00
--  
Dim trv As WinForm.TreeView = e.Sender
Dim nd,nd1 As WinForm.TreeNode
Dim flt,s1 As String
Dim n1,Inum As Integer
nd = trv.SelectedNode

For Each nd1 In nd.allNodes \'同步子节点选中状态
    nd1.Checked = nd.Checked
Next

If nd.ParentNode IsNot Nothing Then   \'确定父节点选中状态:
    For n1 = nd.ParentNode.level To 0 Step -1  \'
        Inum = nd.ParentNode.Nodes.Count \'利用muhua老师的
        For Each nd1 In nd.ParentNode.Nodes
            Inum+ = Val(nd1.Checked)
        Next
        nd.ParentNode.Checked = (Inum = 0)
        nd = nd.ParentNode
    Next
End If
For Each NdType  As WinForm.TreeNode In trv.Nodes
    Select Case NdType.Name
        Case "开票日期"
            Dim Lbs As String() ={"开票日期","年","月"} \'目錄樹級數                     我的想法是 开票日期 这个是分类节点,可以取掉
            For Each nd  In trv.AllNodes
                If nd.Level > 0 AndAlso nd.ParentNode.Checked Then \'如果父节点选中
                    Continue For \'跳过此节点,处理下一结点
                End If
                If nd.Checked Then
                    n1=1
                    For Each s1 In nd.FullName.split("\\")                  ’这个地方 我的想法是如果选中的分类节点不是日期,就不要执行开票日期条件的合成了
                        If s1<>"开票日期" Then                           
                            flt+ =iif(n1 =1,") Or (" ," And ") & Lbs(n1) & " = " & s1   
                            n1+=1
                        End If
                    Next
                End If
            Next
            
        Case "发票状态"

        Case "客户名称"

        Case "项目名称"
    End Select
Next




If flt IsNot Nothing Then
    msgbox(flt.Substring(4) & ")")
End If

’ 我希望的结果是 0级分类 不参与合成表达式 



--  作者:有点蓝
--  发布时间:2020/8/6 16:07:00
--  
……
For Each NdType  As WinForm.TreeNode In trv.Nodes
    if NdType.level = 0 then continue for
    Select Case NdType.Name
        Case "开票日期"
……

--  作者:nxhylczh
--  发布时间:2020/8/6 16:40:00
--  
不合成任何条件字符串了。。。。。。。图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看
--  作者:有点蓝
--  发布时间:2020/8/6 17:10:00
--  
For Each NdType  As WinForm.TreeNode In trv.AllNodes