以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]逻辑列在目录树节点显示  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=119211)

--  作者:zcgmxf
--  发布时间:2018/5/20 11:21:00
--  [求助]逻辑列在目录树节点显示
老师,在目录树显示逻辑列时,如何让 false 显示为 未付款 true 显示为已付款 ?谢谢!

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


--  作者:有点甜
--  发布时间:2018/5/20 21:26:00
--  

循环修改

 

Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As WinForm.TreeNode In trv.AllNodes
    If nd.level = 1 Then
        If nd.Text = "False" Then
            nd.text = "否"
        Else
            nd.text = "是"
        End If
    End If
Next


--  作者:zcgmxf
--  发布时间:2018/5/22 6:17:00
--  
老师,在下面代码中报错。在单选未付款 或 已付款时就报错,如果勾选  供货单位没得问题。

.NET Framework 版本:2.0.50727.8762
Foxtable 版本:2018.3.9.1
错误所在事件:
详细错误信息:
无法在 System.Boolean 和 System.String 上执行“=”操作。

Dim Lbs As String() ={"供货单位","确认付款","金额","日期"}  \'目錄樹級數
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 nd In trv.AllNodes
    If nd.Level > 0 AndAlso nd.ParentNode.Checked Then \'如果父节点选中
        Continue For \'跳过此节点,处理下一结点
    End If
    If nd.Checked Then
        n1=0
        For Each s1 In nd.FullPath.split("\\")
            flt+ =iif(n1 =0,") Or (" ," and ")  & Lbs(n1) & " = \'" & s1 & "\'"
            n1+=1
        Next
    End If
Next

If  flt  IsNot Nothing  Then
    e.Form.Controls("TextBox1").value = flt.Substring(4) & ")"
    Tables("疫苗药品入库单").Filter = flt.Substring(4) & ")"
End If

--  作者:有点甜
--  发布时间:2018/5/22 8:50:00
--  

参考这里的做法

 

http://www.foxtable.com/webhelp/scr/2503.htm

 

Dim nms As String() = {"产品","客户","雇员"} \'指定生成目录树的各列
Dim qts As String() = {"\'","\'","\'"} \'指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
Dim nd As WinForm.TreeNode
For Each nd In e.node.allNodes \'清除子节点的选中标记
    nd.Checked = False
Next
nd = e.Node.ParentNode
Do While nd IsNot Nothing \'清除父节点的选中标记
    nd.Checked = False
    nd = nd.ParentNode
Loop
For Each nd In trv.AllNodes
    If nd.Checked  Then
        Dim rts() As String = nd.FullName.Split("\\")
        Dim val As String = ""
        For i As Integer = 0 To rts.length - 1
            If val > "" Then
                val = val & " And "
            End If
            val = val & nms(i) & " = " & qts(i) & rts(i) & qts(i)
        Next
        If flt > "" Then
            flt = flt & " Or (" & val & ")"
        Else
            flt = val
        End If
    End If
Next
Tables("订单").Filter  = flt


--  作者:有点甜
--  发布时间:2018/5/22 8:51:00
--  

或者你试试把

 

For Each s1 In nd.FullPath.split("\\")

 

改成

 

For Each s1 In nd.FullName.split("\\")