以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]重复值筛选  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=81049)

--  作者:dixiaxiaodan
--  发布时间:2016/2/17 13:32:00
--  [求助]重复值筛选
图片点击可在新窗口打开查看
我想设计一个功能,将飞机号、系统章节发生重复的行,筛选出来,能实现吗?

--  作者:大红袍
--  发布时间:2016/2/17 14:34: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 not in (" & idx.trim(",") & ")"


--  作者:dixiaxiaodan
--  发布时间:2016/2/17 14:37:00
--  
 红袍哥,给你跪了,太厉害了!