Foxtable(狐表)用户栏目专家坐堂 → 请教分类后安时间段筛选怎加入第二层分类筛选?


  共有5750人关注过本帖树形打印复制链接

主题:请教分类后安时间段筛选怎加入第二层分类筛选?

美女呀,离线,留言给我吧!
采菊东篱下
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1882 积分:10385 威望:0 精华:0 注册:2019/4/6 8:45:00
请教分类后安时间段筛选怎加入第二层分类筛选?  发帖心情 Post By:2022/8/3 15:44:00 [显示全部帖子]


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

因为加入了条件,原来的一层分类后安时间加载,现改为加入第二层分类后再安时间加载,我改了一晚,非常乱,还是请教老师吧,红色标注代码是加入去的,报错:
.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2022.7.23.8
错误所在事件:
详细错误信息:
Syntax error: Missing operand after '' operator. 

.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2022.7.23.8
错误所在事件:加载[缴费情况]失败!
详细错误信息:
语法错误 (操作符丢失) 在查询表达式 '(1=2 Or (分类= '临时停车' And (明细分类 = '外来临时停车' or () or () or () or () or () or () or ())))' 中。


Dim trv As WinForm.TreeView = e.Sender
Dim flt, flt1, flt2, flt3, flt4, flt5 As String
If e.Node.Name = "显示所有数据" Then'专处理显示所有数据的勾选选项打勾后缴费情况表的筛选问题,打勾全显,去除勾不显.
    If e.Node.Checked Then
        For Each nd As WinForm.TreeNode In trv.AllNodes
            nd.Checked = False
        Next
        e.Node.Checked = True
    Else
        flt = "1=2"
    End If
Else
    flt = "1=2"
    Dim nms As String() = {"明细分类", "住址_巷", "住址_号", "住址_房", "姓名", "手机号码", "车牌号码"} '指定生成目录树的各列
    Dim qts As String() = {"'", "'", "'", "'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    Dim nms1 As String() = {"明细分类", "年", "月", "车牌号码"} '指定生成目录树的各列
    Dim qts1 As String() = {"'", "", "", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    Dim nms2 As String() = {"住址_巷", "住址_号", "住址_房", "单位名称", "姓名", "手机号码"} '指定生成目录树的各列
    Dim qts2 As String() = {"'", "'", "'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    Dim nms3 As String() = {"单位名称", "手机号码"} '指定生成目录树的各列
    Dim qts3 As String() = {"'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    For Each nd1 As WinForm.TreeNode In e.Node.AllNodes '清除子节点的选中标记
        nd1.Checked = e.Node.Checked
    Next
    Dim pd As WinForm.TreeNode = e.Node.ParentNode
    If pd IsNot Nothing Then
        Dim bb As Boolean = True
        For Each nd2 As WinForm.TreeNode In pd.Nodes
            If nd2.Checked = False Then
                bb = False
                Exit For
            End If
        Next
        pd.Checked = bb 
    End If
    For Each nd As WinForm.TreeNode In trv.AllNodes
        If nd.Checked Then
            Dim val As String = ""
            Dim rts() As String = nd.FullPath.Split("\")
            If nd.FullPath Like DataTables("分类").DataRows(0)("分类") & "*" Then
                For i As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms(i - 1) & " = " & qts(i - 1) & rts(i) & qts(i - 1)
                Next
                If flt1 > "" Then
                    flt1 = flt1 & " or (" & val & ")"
                Else
                    flt1 = val
                End If
           ElseIf nd.FullPath Like DataTables("分类").DataRows(1)("分类") & "*" Then
                For i1 As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    If rts.Length <= 2 Then 
                        val = val & nms1(i1 - 1) & " = " & qts1(i1 - 1) & rts(i1) & qts1(i1 - 1)
                    End If
                Next
                If flt2 > "" Then
                    flt2 = flt2 & " And (" & val & ")"
                Else
                    flt2 = val
                End If
                Dim d1, d2 As Date
                If rts.Length = 3 Then
                    d1 = New Date(CInt(rts(2)), 1, 1)
                    d2 = New Date(CInt(rts(2)), 12, 31)
                ElseIf rts.Length > 3 Then
                    d1 = New Date(CInt(rts(2)), CInt(rts(3)), 1)
                    d2 = New Date(CInt(rts(2)), CInt(rts(3)), Date.DaysInMonth(CInt(rts(2)), CInt(rts(3))))
                End If
                val = val & " 日期 >= #" & d1 & "# And 日期 <=#" & d2 & "#"
                If nd.Level = 4 Then
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & " 车牌号码 = '" & nd.Text & "'"
                End If
                If flt3 > "" Then
                    flt3 = flt3 & " or (" & val & ")"
                Else
                    flt3 = val
                End If
            ElseIf nd.FullPath Like DataTables("分类").DataRows(2)("分类") & "*" Then
                For i As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms2(i - 1) & " = " & qts2(i - 1) & rts(i) & qts2(i - 1)
                Next
                If flt4 > "" Then
                    flt4 = flt4 & " or (" & val & ")"
                Else
                    flt4 = val
                End If
            Else
                For i As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms3(i - 1) & " = " & qts3(i - 1) & rts(i) & qts3(i - 1)
                Next
                If flt5 > "" Then
                    flt5 = flt5 & " or (" & val & ")"
                Else
                    flt5 = val
                End If
            End If
        End If
    Next
    If flt1 > "" Then
        flt1 = "分类= '" & DataTables("分类").DataRows(0)("分类") & "' And (" & flt1 & ")"
    End If
    If flt2 > "" Then
        flt2 = "分类= '" & DataTables("分类").DataRows(1)("分类") & "' And (" & flt2 & ")"
    End If
    If flt4 > "" Then
        flt4 = "分类= '" & DataTables("分类").DataRows(2)("分类") & "' And (" & flt4 & ")"
    End If
    If flt5 > "" Then
        flt5 = "分类= '" & DataTables("分类").DataRows(3)("分类") & "' And (" & flt5 & ")"
    End If
    If flt1 > "" Then
        flt = "(" & flt1 & ")"
    End If
    If flt2 > "" Then
        If flt > "" Then
            flt = flt & " Or "
        End If
        flt = flt & "(" & flt2 & ")"
    End If
    If flt4 > "" Then
        If flt > "" Then
            flt = flt & " Or "
        End If
        flt = flt & "(" & flt4 & ")"
    End If
    If flt5 > "" Then
        If flt > "" Then
            flt = flt & " Or "
        End If
        flt = flt & "(" & flt5 & ")"
    End If
End If
Tables("主界面_Table5").Filter = flt
With DataTables("缴费情况")
    .LoadFilter = flt '设置加载条件
    .LoadPage  = 0
    .LoadTop = 30 '每页5行
    .LoadOrder = "_Identify"
    .LoadReverse = True
    .Load()
    e.Form.Controls("TextBox3").Value = 1 & "/" & .TotalPages
End With
[此贴子已经被作者于2022/8/3 16:08:19编辑过]

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1882 积分:10385 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2022/8/4 15:04:00 [显示全部帖子]

弄了两天,终于把代码改过来没问题了!
Dim trv As WinForm.TreeView = e.Sender
Dim flt, flt1, flt2, flt3, flt4 As String
If e.Node.Name = "显示所有数据" Then'专处理显示所有数据的勾选选项打勾后缴费情况表的筛选问题,打勾全显,去除勾不显.
    If e.Node.Checked Then
        For Each nd As WinForm.TreeNode In trv.AllNodes
            nd.Checked = False
        Next
        e.Node.Checked = True
    Else
        flt = "1=2"
    End If
Else
    flt = "1=2"
    Dim nms As String() = {"明细分类", "住址_巷", "住址_号", "住址_房", "姓名", "手机号码", "车牌号码"} '指定生成目录树的各列
    Dim qts As String() = {"'", "'", "'", "'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    Dim nms1 As String() = {"明细分类", "年", "月", "车牌号码"} '指定生成目录树的各列
    Dim qts1 As String() = {"'", "", "", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    Dim nms2 As String() = {"住址_巷", "住址_号", "住址_房", "单位名称", "姓名", "手机号码"} '指定生成目录树的各列
    Dim qts2 As String() = {"'", "'", "'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    Dim nms3 As String() = {"单位名称", "手机号码"} '指定生成目录树的各列
    Dim qts3 As String() = {"'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
    For Each nd1 As WinForm.TreeNode In e.Node.AllNodes '清除子节点的选中标记
        nd1.Checked = e.Node.Checked
    Next
    Dim pd As WinForm.TreeNode = e.Node.ParentNode
    If pd IsNot Nothing Then
        Dim bb As Boolean = True
        For Each nd2 As WinForm.TreeNode In pd.Nodes
            If nd2.Checked = False Then
                bb = False
                Exit For
            End If
        Next
        pd.Checked = bb 
    End If
    For Each nd As WinForm.TreeNode In trv.AllNodes
        If nd.Checked Then
            Dim val As String = ""
            Dim rts() As String = nd.FullPath.Split("\")
            If nd.FullPath Like DataTables("分类").DataRows(0)("分类") & "*" Then
                For i As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms(i - 1) & " = " & qts(i - 1) & rts(i) & qts(i - 1)
                Next
                If flt1 > "" Then
                    If val > "" Then
                        flt1 = flt1 & " or (" & val & ")"
                    End If
                ElseIf val > "" Then
                    flt1 = val
                End If
            ElseIf nd.FullPath Like DataTables("分类").DataRows(1)("分类") & "*" Then
                For i1 As Integer = 1 To rts.length - 4
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms1(i1 - 1) & " = " & qts1(i1 - 1) & rts(i1) & qts1(i1 - 1)
                    Dim d1, d2 As Date
                    If rts.Length = 3 Then
                        d1 = New Date(CInt(rts(2)), 1, 1)
                        d2 = New Date(CInt(rts(2)), 12, 31)
                    ElseIf rts.Length > 3 Then
                        d1 = New Date(CInt(rts(2)), CInt(rts(3)), 1)
                        d2 = New Date(CInt(rts(2)), CInt(rts(3)), Date.DaysInMonth(CInt(rts(2)), CInt(rts(3))))
                    End If
                    val = val & " And 日期 >= #" & d1 & "# And 日期 <= #" & d2 & "#"
                    If nd.Level = 4 Then
                        If val > "" Then
                            val = val & " And "
                        End If
                        val = val & " 车牌号码 = '" & nd.Text & "'"
                    End If
                Next
                If flt2 > "" Then
                    If val > "" Then
                        flt2 = flt2 & " or 分类= '" & DataTables("分类").DataRows(1)("分类") & "' And (" & val & ")"
                    End If
                ElseIf val > "" Then
                    flt2 = "分类= '" & DataTables("分类").DataRows(1)("分类") & "' And (" & val & ")"
                End If


 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1882 积分:10385 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2022/8/4 15:04:00 [显示全部帖子]

            ElseIf nd.FullPath Like DataTables("分类").DataRows(2)("分类") & "*" Then
                For i As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms2(i - 1) & " = " & qts2(i - 1) & rts(i) & qts2(i - 1)
                Next
                If flt3 > "" Then
                    If val > "" Then
                        flt3 = flt3 & " or (" & val & ")"
                    End If
                ElseIf val > "" Then
                    flt3 = val
                End If
            Else
                For i As Integer = 1 To rts.length - 1
                    If val > "" Then
                        val = val & " And "
                    End If
                    val = val & nms3(i - 1) & " = " & qts3(i - 1) & rts(i) & qts3(i - 1)
                Next
                If flt4 > "" Then
                    flt4 = flt4 & " or (" & val & ")"
                Else
                    flt4 = val
                End If
            End If
        End If
    Next
    If flt1 > "" Then
        flt1 = "分类= '" & DataTables("分类").DataRows(0)("分类") & "' And (" & flt1 & ")"
    End If
    If flt3 > "" Then
        flt3 = "分类= '" & DataTables("分类").DataRows(2)("分类") & "' And (" & flt3 & ")"
    End If
    If flt4 > "" Then
        flt4 = "分类= '" & DataTables("分类").DataRows(3)("分类") & "' And (" & flt4 & ")"
    End If
    If flt1 > "" Then
        flt = "(" & flt1 & ")"
    End If
    If flt2 > "" Then
        If flt > "" Then
            flt = flt & " Or "
        End If
        flt = flt & "(" & flt2 & ")"
    End If
    If flt3 > "" Then
        If flt > "" Then
            flt = flt & " Or "
        End If
        flt = flt & "(" & flt3 & ")"
    End If
    If flt4 > "" Then
        If flt > "" Then
            flt = flt & " Or "
        End If
        flt = flt & "(" & flt4 & ")"
    End If
End If
Tables("主界面_Table5").Filter = flt
With DataTables("缴费情况")
    .LoadFilter = flt '设置加载条件
    .LoadPage  = 0
    .LoadTop = 30 '每页5行
    .LoadOrder = "_Identify"
    .LoadReverse = True
    .Load()
    e.Form.Controls("TextBox3").Value = 1 & "/" & .TotalPages
End With

 回到顶部