以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=92451)

--  作者:ygg8310
--  发布时间:2016/11/3 15:39:00
--  求助
如何实现多列筛选???
--  作者:ygg8310
--  发布时间:2016/11/3 15:42:00
--  
就是多列重复
--  作者:有点青
--  发布时间:2016/11/3 15:47:00
--  

参考

 

Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第一列,第二列"
For Each dr As DataRow In DataTables("表A").Select("", cs)
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        For Each c As String In cs.split(",")
            If pdr(c).replace(" ","") <> dr(c).replace(" ", "") Then
                flag = True
                Exit For
            End If
        Next
        If flag Then
            If count > 1 Then
                idx &= idx_temp
            End If
            count = 1
            idx_temp = ""
        Else
            count += 1
            idx_temp &= dr("_Identify") & ","
        End If
    Else
        count += 1
    End If
    pdr = dr
Next

If count > 1 Then
    idx &= idx_temp
End If

\'Tables("表A").filter = "_Identify not In (" & idx.trim(",") & ")"
Tables("表A").filter = "_Identify In (" & idx.trim(",") & ")"


 


--  作者:ygg8310
--  发布时间:2016/11/3 15:56:00
--  
可不可以实现显示重复值,例如姓名,身份账号,将同名同号的列出来
--  作者:ygg8310
--  发布时间:2016/11/3 16:17:00
--  

Tables("A").RepeatFilter("第一列", 0)

Tables("A").RepeatFilter("第二列", 0)

就像这个功能差不多,第一列+第二列的值,但只是显示出来


--  作者:有点蓝
--  发布时间:2016/11/3 17:22:00
--  
Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "户号,户主姓名"
Dim drs As List(Of DataRow) = DataTables("表A").Select("", cs)

For Each dr As DataRow In drs
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        For Each c As String In cs.split(",")
            If pdr(c).replace(" ","") <> dr(c).replace(" ", "") Then
                flag = True
                Exit For
            End If
        Next
        If flag Then
            If count > 1 Then
                idx &= idx_temp
            End If
            count = 1
            idx_temp = ""
        Else
            count += 1
            If count = 2 Then idx_temp &= pdr("_Identify") & ","
            idx_temp &= dr("_Identify") & ","
        End If
    Else
        count += 1
    End If
    pdr = dr
Next
If count > 1 Then
    idx &= idx_temp
End If
\'Tables("表A").filter = "_Identify not In (" & idx.trim(",") & ")"
Tables("表A").filter = "_Identify In (" & idx.trim(",") & ")"