Foxtable(狐表)用户栏目专家坐堂 → [求助]多列重复值筛选出错


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

主题:[求助]多列重复值筛选出错

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


加好友 发短信
等级:六尾狐 帖子:1394 积分:10728 威望:0 精华:0 注册:2013/11/8 15:27:00
[求助]多列重复值筛选出错  发帖心情 Post By:2022/4/10 16:24:00 [显示全部帖子]

照搬了论坛中的一个多列重复值筛选功能,当中间有一列是数值型时好象就会有问题
Dim ct As Table =args(0)
Dim dtb As New DataTableBuilder("统计")
dtb.AddDef("列名", Gettype(String), 32)
dtb.Build()

For Each dc As Col In CurrentTable.Cols 
Dim Values1 As New List(Of String)
Values1.Add(dc.name)
For i As Integer = 0 To Values1.Count -1
    Dim dr1 As DataRow
    dr1 = DataTables("统计").Find("列名 ='" & dc.name & "'")
    If dr1 Is Nothing Then
    Dim dr As DataRow = DataTables("统计").AddNew()
    dr("列名") = Values1(i)
    End If
Next
Next

Dim Lms As String  = e.Form.Controls("SXL").value
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


图片点击可在新窗口打开查看此主题相关图片如下:3f62e229-26ef-438b-93e4-aa2c70f2c90a.png
图片点击可在新窗口打开查看




[此贴子已经被作者于2022/4/10 16:28:35编辑过]

 回到顶部