以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]当前表,列名有“含”字的列=含,列名有“壹”字的列值大于x的行筛选 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=193223) |
||||
-- 作者:185723664 -- 发布时间:2024/8/27 18:52:00 -- [求助]当前表,列名有“含”字的列=含,列名有“壹”字的列值大于x的行筛选 求助 窗口按钮代码,实现 当前表,列名有“含”字的列值=含,列名有“壹”字的列值大于x(窗口文本控件里录入的数值)的行筛选
[此贴子已经被作者于2024/8/27 18:52:17编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/8/27 20:11:00 --
|
||||
-- 作者:185723664 -- 发布时间:2024/8/28 9:08:00 -- 回复:(有点蓝)[upload=zip,11.zip]viewFile.asp?ID... 蓝大师,上楼项目执行没有效果 想实现的效果是 黄色和绿色 2个条件都成立时的行筛选出来 此主题相关图片如下:第2行显示不对,要求2个条件同时成立.jpg 我把上楼代码改成下面还是有问题,多显示了红色的第2行 Dim filter As String = "1=1 " Dim x As String = e.Form.Controls("ComboBox1").text For Each c As Col In Tables("表A").Cols \' If c.Name.Contains("含") Then \' filter = filter & " and " & c.Name & "=\'含\'" \' ElseIf c.Name.Contains("壹") Then \' filter = filter & " and " & c.Name & ">\'" & x & "\'" \' End If If c.Name.Contains("壹") Then filter = filter & " and " & c.Name & ">\'" & x & "\'" End If Next Tables("表A").filter = filter 求助 黄色和绿色 2个条件都成立时的行筛选出来
[此贴子已经被作者于2024/8/28 9:10:10编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/8/28 9:18:00 -- 这个条件不能算都成立。里面还包含了部分处理。比如3个含列,指全部都有【含】,还是只是其中一个列有就算?同样情况还有3个壹列,上面都没有说清楚,所以我的代码是按全部算的。自己理清思路,如果只是其中一个对应自己看看怎么改改代码 |
||||
-- 作者:185723664 -- 发布时间:2024/8/28 9:53:00 -- 回复:(有点蓝)这个条件不能算都成立。里面还包含了... 蓝大师,下面代码报错 .NET Framework 版本:4.0.30319.42000 Foxtable 版本:2022.8.18.1 错误所在事件: 详细错误信息: 语法错误:“=”运算符前缺少操作数。 求助 c.Name.Contains("含") 的列行值=\'含\'的行筛选
Dim filter As String = "1=1 " Dim x As String = e.Form.Controls("ComboBox1").text For Each c As Col In Tables("表A").Cols If c.Name.Contains("含") Then For Each rf As Row In Tables("表A").rows filter = filter & " And " & rf(c.Name) & " = \'含\'" Next \' ElseIf c.Name.Contains("壹") Then filter = filter & " And " & c.Name & " > \'" & x & "\'" End If Next Tables("表A").filter = filter |
||||
-- 作者:有点蓝 -- 发布时间:2024/8/28 9:55:00 -- filter = filter & " or " & c.Name & " = \'含\'" [此贴子已经被作者于2024/8/28 9:56:03编辑过]
|
||||
-- 作者:185723664 -- 发布时间:2024/8/28 10:18:00 -- 回复:(有点蓝)filter = filter & " or&nb... 蓝大师,按上楼 and 改成 or,还是跟想要的效果不符 Dim filter As String = "1=1 " Dim x As String = e.Form.Controls("ComboBox1").text For Each c As Col In Tables("表A").Cols If c.Name.Contains("含") Then filter = filter & " and " & c.Name & "=\'含\'" 求助,改成不要所有列值都= 含,有1列值=含就可以 ElseIf c.Name.Contains("壹") Then filter = filter & " or " & c.Name & ">\'" & x & "\'" End If Next Tables("表A").filter = filter
|
||||
-- 作者:有点蓝 -- 发布时间:2024/8/28 10:37:00 -- Dim filter As String = "1=2 " Dim filter2 As String = "1=2 " Dim x As String = e.Form.Controls("ComboBox1").text For Each c As Col In Tables("表A").Cols If c.Name.Contains("含") Then filter = filter & " or " & c.Name & "=\'含\'" 求助,改成不要所有列值都= 含,有1列值=含就可以 ElseIf c.Name.Contains("壹") Then filter2 = filter2 & " or " & c.Name & ">\'" & x & "\'" End If Next Tables("表A").filter = "(" & filter & ") and (" & filter2 & ")" msgbox(Tables("表A").filter)
|