以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  in在代码中失效了?没有失效——问题解决了  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=94635)

--  作者:shenyl0211
--  发布时间:2016/12/28 15:35:00
--  in在代码中失效了?没有失效——问题解决了
以下代码中的in,类似于表达式的用法,非常方便,去年的开发版是能用的,但今年的版本怎么失效了?
(虽然不会因为用了in而提示错误,但只显示一个人员,其他人员不显示)
而且出差、请假、加班都要用到的。
xmjl=1——是项目经理;ye1、ye0——年度;mo1、mo0——月份
问题解决了:把蓝色代码改成红色代码
    Case "出差管理"
        Dim Names As List(of String)
        Dim name,name0 As String
        Dim ta As New DropTreeBuilder
        ta.SourceTable = DataTables("人员管理")
        Ta.treesort = "部门名称,员工姓名"
        ta.TreeCols = "部门名称|员工姓名"
        ta.SourceCols = "部门名称|员工姓名|差费标准"
        ta.ReceiveCols = "部门名称|姓名|差费标准"
        If _userroles <> "开发者" AndAlso _userroles <> "管理者" AndAlso _userroles <> "审核人员"  Then
            If  xmjl = 1 OrElse ((_userroles = "部门干事" OrElse _userroles = "部门领导" OrElse _userroles = "财务领导" OrElse _userroles = "生产领导") AndAlso _office = "机关") Then
                If xmjl = 1 Then
                    names = DataTables("考勤管理").SQLGetValues("姓名","[复核人] = \'" & _username & "\' and (([年度] = " & ye1 & " and [月份] = " & mo1 & ") or ([年度] = " & ye0 & " and [月份] = " & mo0 & "))")
                Else
                    names = DataTables("考勤管理").SQLGetValues("姓名","[复核人] <> \'\' and (([年度] = " & ye1 & " and [月份] = " & mo1 & ") or ([年度] = " & ye0 & " and [月份] = " & mo0 & "))")
                End If
                If names.Count > 0 Then
                    For Each name In names
                        name0 = name0 & ",\'" & name & "\'"
                    Next
                    name0 = name0.trim(",")
                    ta.TreeFilter = "[部门名称] in (" & _usergroup & ") and [员工姓名] in (" & name0 & ")"
                    DataTables("人员管理").LoadFilter ="[部门名称] in (" & _usergroup & ") and [员工姓名] in (" & name0 & ")"
                    DataTables("人员管理").Load
                Else
                    ta.TreeFilter = "[员工姓名] = \'\'"
                End If
            Else
                ta.TreeFilter = "[员工姓名] = \'\'"
            End If
        End If
        CurrentTable.Cols("部门名称").DropTree = ta.Build()
[此贴子已经被作者于2016/12/28 15:49:19编辑过]

--  作者:有点色
--  发布时间:2016/12/28 15:44:00
--  

 弹出你的表达式,看值是什么,msgbox("[部门名称] in (" & _usergroup & ") and [员工姓名] in (" & name0 & ")")

 

 你的值,应该赋初值为 \'\',不然name0等没有值的时候,肯定是会报错的

 

 Dim name0 As String = "\'\'"


--  作者:有点色
--  发布时间:2016/12/28 15:44:00
--  

 具体问题,做例子上来说明。