Foxtable(狐表)用户栏目专家坐堂 → 任意列数重复值判断通用代码


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

主题:任意列数重复值判断通用代码

帅哥哟,离线,有人找我吗?
don
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12999 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2015/7/2 1:13:00 [显示全部帖子]

這樣或通用些:

Dim Lms As String  = "上级部门,单位名称,姓名"
Dim Lmst() As String  = Lms.Split(",")

Dim str0 As New List (Of String)
Dim str1 As New List (Of String)
Dim id0,id1,flt,celltext As String

'+++++++++++++++++++++++++++++++++
For Each r As Row In CurrentTable.Rows
    celltext=Nothing
    For i As Integer = 0 To Lmst.Length-1
        celltext+=r(Lmst(i))
    Next
    
    If str0.Contains(celltext) =False Then
        id0 + = r("_Identify") & ","
    Else
        str1.Add(celltext)
    End If
    str0.Add(celltext)
Next

'++++++++++++++++++++++++++++++++
For Each r As Row In CurrentTable.Rows
    celltext=Nothing
    For i As Integer = 0 To Lmst.Length-1
        celltext+=r(Lmst(i))
    Next
    
    If str1.Contains(celltext) Then
        id1 + = r("_Identify") & ","
    End If
Next

'+++++++++++++++++++++++++++++++++
If id1 > "" Then
    id1 = id1.Trim(",")
    flt = "_Identify In (" & id1 & ")"
End If

CurrentTable.Filter = flt
CurrentTable.Sort= Lms
[此贴子已经被作者于2015/7/2 1:13:42编辑过]

 回到顶部