以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- excel数据源的项目如何进行多行多列值筛选,如何只显示不同的数据? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=172863) |
||||
-- 作者:cnsjroom -- 发布时间:2021/11/4 17:23:00 -- excel数据源的项目如何进行多行多列值筛选,如何只显示不同的数据? excel数据源的项目如何进行多行多列值筛选,如何只显示不同的数据? 因excel作为数据源之后 表中并无主键_Identify 下述代码怎么修整呢? 【多行多列筛选】按钮事件代码如下: Dim s As String Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1") For Each Index As Integer In l.CheckedIndices s = s & "," & l.Items(Index) Next s = s.trim(",") Dim cs As String = s Dim idx As String = "" Dim lst As new List(of String) Dim flag As Boolean Dim drs As List(Of DataRow) = DataTables(Vars("btname")).Select("第一列 is not null", cs) Dim pdr As DataRow = drs(0) Dim dr As DataRow For i As Integer = 1 To drs.count - 1 dr = drs(i) flag = False For Each c As String In cs.split(",") If pdr(c) <> dr(c) Then flag = True Exit For End If Next If flag = False Then If lst.Contains(pdr("_Identify")) = False lst.add( pdr("_Identify") ) End If lst.add( dr("_Identify") ) End If pdr = dr Next If lst.count > 0 Then idx = String.Join(",",lst.ToArray) Tables(Vars("btname")).filter = "第一列 is not null and _Identify not in (" & idx.trim(",") & ") " Else MessageBox.Show("没有重复数据!") End If [此贴子已经被作者于2021/11/4 18:04:03编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2021/11/4 17:42:00 -- 这种没有办法。要么在execl里添加一个唯一值列;要么导入Foxtable处理 |
||||
-- 作者:cnsjroom -- 发布时间:2021/11/4 18:14:00 -- 回复:(有点蓝)这种没有办法。要么在execl里添加一个... 那如果导入狐表后 要查找相同的值得行 并显示出来 原始数据表: 此主题相关图片如下:2.png 多行多列筛选相同的值 下述代码怎么修改呢?【代码运行之后直接显示无数据行】 Dim s As String Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1") For Each Index As Integer In l.CheckedIndices s = s & "," & l.Items(Index) Next s = s.trim(",") Dim cs As String = s Dim idx As String = "" Dim lst As new List(of String) Dim flag As Boolean Dim drs As List(Of DataRow) = DataTables(Vars("btname")).Select("第一列 is not null", cs) Dim pdr As DataRow = drs(0) Dim dr As DataRow For i As Integer = 1 To drs.count - 1 dr = drs(i) flag = False For Each c As String In cs.split(",") If pdr(c) <> dr(c) Then 改为If pdr(c)= dr(c) Then 则直接没有数据显示了 貌似条件数据不符合一样 flag = True Exit For End If Next If flag = False Then If lst.Contains(pdr("_Identify")) = False lst.add( pdr("_Identify") ) End If lst.add( dr("_Identify") ) End If pdr = dr Next If lst.count > 0 Then idx = String.Join(",",lst.ToArray) Tables(Vars("btname")).filter = "第一列 is not null and _Identify not in (" & idx.trim(",") & ") " Else MessageBox.Show("没有重复数据!") End If 单行多列筛选相同的值 代码如下:运行也得到不同部分的数据,怎么修整呢? Dim s As String Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1") For Each Index As Integer In l.CheckedIndices s = s & "," & l.Items(Index) Next s = s.trim(",") Dim cs As String = s Dim filter As String = "1=2" Dim ss() As String = s.split(",") Dim s1 As String = ss(0) For i As Integer = 1 To ss.length - 1 filter = filter & " or " & s1 & " = " & ss(i) Next MessageBox.Show(filter) Tables(Vars("btname")).filter = filter 运行效果: [此贴子已经被作者于2021/11/4 21:34:04编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2021/11/4 20:29:00 -- 多行多列没看懂要实现什么效果?举例说明一下 单行多列筛选相同的值 代码如下:运行也得到不同部分的数据,怎么修整呢? Dim s As String Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1") For Each Index As Integer In l.CheckedIndices s = s & "," & l.Items(Index) Next s = s.trim(",") Dim cs As String = s Dim filter As String = "1=1" Dim ss() As String = s.split(",") Dim s1 As String = ss(0) For i As Integer = 1 To ss.length - 1 filter = filter & " and " & s1 & " = " & ss(i) Next |
||||
-- 作者:cnsjroom -- 发布时间:2021/11/4 21:33:00 -- 回复:(有点蓝)多行多列没看懂要实现什么效果?举例... 原始数据图 目前在单行或多行数据筛选中 选择相同数据都只显示如下空白
|
||||
-- 作者:有点蓝 -- 发布时间:2021/11/4 21:56:00 --
|