以文本方式查看主题

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

--  作者:lgj716330
--  发布时间: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编辑过]

--  作者:有点蓝
--  发布时间:2022/4/10 20:58:00
--  
+=改为&=