以文本方式查看主题

-  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=23319)

--  作者:zpx_2012
--  发布时间:2012/9/8 22:48:00
--  目录树过渡表数据的代码要怎么写?

各位老师,

如下图:我在单据审批中当选定流程子节点时想筛选出父节点的表的需要审批的单据出来


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

 

 

用了如下的代码,但红色这行怎么写按确定都不能通过

Dim Filter As String
Dim Value()As String
Value = e.Node.FullPath.Split("\\")
Select Case e.Node.Level
    Case 0
        Tables(e.Node.Text).Filter = ""
        MainTable = Tables(e.Node.Text)
        DataTables.AllowEdit = True
    Case 1
        \'得到单据审批记录表中未结束的需要审批表单的编号
        Dim nms As List(Of String)
        nms = DataTables("单据审批记录").GetUniqueValues("表名= \'" & e.Node.ParentNode.Text & "\' and 结束 = false", "编号")
        \'从系统表中得到当前父节点的表使用的单据编号列的名称,然后过滤得到编号在单据审批记录中的表.
        Dim dr As DataRow = DataTables("系统表").Find("表名 = \'" & e.Node.ParentNode.Text & "\'")
        If dr IsNot Nothing Then
            Dim num As String = dr("单据编号列")
            Tables(e.Node.ParentNode.Text).Filter = "dr("单据编号列")  In " & nms & ""
             MainTable = Tables(e.Node..ParentNode.Text)
        DataTables.AllowEdit = True

        End If
End Select

 

请问要怎么写才正确,

 

谢谢!


 


--  作者:狐狸爸爸
--  发布时间:2012/9/9 10:15:00
--  

不说业务逻辑,In运算符的语法:

 

In 运算符用来判断某一个值是否在指定的一系列值中,例如:

[国籍] In (\'中国\',\'美国\',\'英国\',\'法国\',\'俄罗斯\')

表示判断国籍是否是上述五国之一,显然这比用OR来连接多个表达式要简洁很多。

记得数值型的列,值不要用单引号括起来,例如:

[订单号] In (1, 3, 4, 6, 7,12)

而日期型的列,值需要用符号#括起来,例如:

[日期] In (#7/2/2012#, #7/12/2012#, #8/30/2012#)

 

假定编号列是字符型,应该这样修改代码:

 

Dim Filter As String
Dim Value()As String
Value = e.Node.FullPath.Split("\\")
Select Case e.Node.Level
    Case 0
        Tables(e.Node.Text).Filter = ""
        MainTable = Tables(e.Node.Text)
        DataTables.AllowEdit = True
    Case 1
        \'得到单据审批记录表中未结束的需要审批表单的编号
        Dim nms As =String
        nms = DataTables("单据审批记录").GetComboListString("编号","表名= \'" & e.Node.ParentNode.Text & "\' and 结束 = false")
        If nms > "" Then
            nms = "\'" & nms.replace("|","\',\'")  & "\'"
            \'从系统表中得到当前父节点的表使用的单据编号列的名称,然后过滤得到编号在单据审批记录中的表.
            Dim dr As DataRow = DataTables("系统表").Find("表名 = \'" & e.Node.ParentNode.Text & "\'")
            If dr IsNot Nothing Then
                Dim num As String = dr("单据编号列")
                Tables(e.Node.ParentNode.Text).Filter = dr("单据编号列")  & "In (" & nms & ")"
                MainTable = Tables(e.Node..ParentNode.Text)
                DataTables.AllowEdit = True
            End If
        End If
End Select

 

你可以看看:

http://www.foxtable.com/help/topics/2228.htm

http://www.foxtable.com/help/topics/2410.htm