以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]多条件筛选问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=112951) |
-- 作者:188802386 -- 发布时间:2018/1/5 16:01:00 -- [求助]多条件筛选问题 \'授权加载数据 _dat = "commission" Dim dr As DataRow = DataTables("users").SQLFind("姓名 =\'" & _xingming & "\'") If dr Is Nothing OrElse dr.IsNull("加载范围集合") Then DataTables(_dat).LoadFilter = "1" DataTables(_dat).load Else Dim dtn() As String = dr("加载范围集合").split(",") For Each tn As String In dtn Dim ts() As String = tn.Split("|") Select Case ts(0) Case "佣金管理" Select Case ts(1) Case "本部" DataTables(_dat).LoadFilter = "部门名称 in (\'" & dr("本部集合").replace(",","\',\'") & "\')" Case "所有" DataTables(_dat).LoadFilter = "公司编号 = \'" & _gsbh & "\'" Case Else DataTables(_dat).LoadFilter = "置业顾问 =\'" & _xingming & "\'" End Select End Select DataTables(_dat).load Next End If 上面是通过授权来判断某人可以看那些内容,但窗口中又设置了一些按钮,点击查询后,能否将筛选出来的内容在通过授权来判断的权限查看内容以内,下面是窗口的按钮,望高手帮忙合并一下,谢谢 Dim Filter As String With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "部门所属 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "部门名称 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox3") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "置业顾问 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox4") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "状态 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox5") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "佣金类型 = \'" & .Value & "\'" End If End With With e.Form.Controls("StartDate") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "结佣日 >= \'" & .Value & "\'" End If End With With e.Form.Controls("EndDate") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "结佣日 <= \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker1") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "成交日期 >= \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker2") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "成交日期 <= \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker3") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "日期 >= \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker4") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "日期 <= \'" & .Value & "\'" End If End With If Filter > "" Then DataTables("commission").LoadFilter = Filter DataTables("commission").Load End If [此贴子已经被作者于2018/1/5 16:01:46编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/1/5 16:48:00 -- 1、用一个变量记录限定的条件,如
DataTables(_dat).load vars("filter") = DataTables(_dat).LoadFilter
2、加上变量的条件,如
If Filter > "" Then
DataTables("commission").LoadFilter = Filter & " and " & vars("filter")
DataTables("commission").Load
End If
|
-- 作者:有点甜 -- 发布时间:2018/1/5 16:49:00 -- 或者,可以直接在beforeLoad事件处理
http://www.foxtable.com/webhelp/scr/2057.htm
|