以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]多列内容,如何排除重复值? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=83243) |
||||
-- 作者:fengwenliuyan -- 发布时间:2016/4/5 10:11:00 -- [求助]多列内容,如何排除重复值? 表A有5列:客户列、工序列、品名规格列、单位列、单价列。 要求:按其中的“客户列”和“工序列”的内容,排除重复值进行筛选? “排序与筛选”里的“排除重复值”,貌似只能筛选单列? |
||||
-- 作者:大红袍 -- 发布时间:2016/4/5 10:13:00 -- 参考代码
Dim idx As String = "-1," If count > 1 Then Tables("表A").filter = "_Identify in (" & idx.trim(",") & ")" |
||||
-- 作者:fengwenliuyan -- 发布时间:2016/4/5 10:16:00 -- [讨论]不能直接通过系统里的高级筛选项操作吗? 不能直接通过系统里的高级筛选项操作吗? |
||||
-- 作者:fengwenliuyan -- 发布时间:2016/4/5 10:16:00 -- 不能直接通过系统里的高级筛选项操作吗? |
||||
-- 作者:大红袍 -- 发布时间:2016/4/5 10:18:00 -- 不能,高级筛选那里,只能单列的。你直接用代码吧,指定列和表即可。 |
||||
-- 作者:fengwenliuyan -- 发布时间:2016/4/5 10:33: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("询价表").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 End If idx_temp &= dr("_Identify") & "," pdr = dr Next If count > 1 Then idx &= idx_temp End If Tables("询价表").filter = "_Identify in (" & idx.trim(",") & ")"
|
||||
-- 作者:大红袍 -- 发布时间:2016/4/5 10:35:00 -- 代码没有问题,如果卡机,做个具体的foxtable例子上来看看。 |
||||
-- 作者:fengwenliuyan -- 发布时间:2016/4/5 10:42: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("询价表").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 End If idx_temp &= dr("_Identify") & "," pdr = dr Next If count > 1 Then idx &= idx_temp End If Tables("询价表").filter = "_Identify in (" & idx.trim(",") & ")" |
||||
-- 作者:大红袍 -- 发布时间:2016/4/5 10:59:00 --
[此贴子已经被作者于2016/4/5 11:24:51编辑过]
|
||||
-- 作者:fengwenliuyan -- 发布时间:2016/4/5 11:08:00 -- 试验过,只是排除了空白项,重复项依旧存在??? 此主题相关图片如下:{a~jx4ep~70_0hhe@8y0m.png 此主题相关图片如下:f~k0~rayt%od`of45k%$fe.png |