以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  老师,麻烦帮我看下下面代码哪里出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=98136)

--  作者:jick0526
--  发布时间:2017/3/24 17:39:00
--  老师,麻烦帮我看下下面代码哪里出错
老师,麻烦帮我看下下面代码哪里出错,第一列和第二列都重复时,筛选冗余值

Tables("表A").RepeatFilter("第一列"\'and "第二列", 2)

--  作者:有点色
--  发布时间:2017/3/24 17:48: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) <> dr(c) Then
                flag = True
                Exit For
            End If
        Next
    End If
    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
   
    pdr = dr
Next

If count > 1 Then
    idx &= idx_temp
End If

Tables("表A").filter = "_Identify in (" & idx.trim(",") & ")"