Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共8 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]当前表,列名有“含”字的列=含,列名有“壹”字的列值大于x的行筛选

1楼
185723664 发表于:2024/8/27 18:52:00
求助 窗口按钮代码,实现
当前表,列名有“含”字的列值=含,列名有“壹”字的列值大于x(窗口文本控件里录入的数值)的行筛选

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:11.foxdb


[此贴子已经被作者于2024/8/27 18:52:17编辑过]
2楼
有点蓝 发表于:2024/8/27 20:11:00
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:11.zip

3楼
185723664 发表于:2024/8/28 9:08:00
蓝大师,上楼项目执行没有效果
想实现的效果是 黄色和绿色 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编辑过]
4楼
有点蓝 发表于:2024/8/28 9:18:00
这个条件不能算都成立。里面还包含了部分处理。比如3个含列,指全部都有【含】,还是只是其中一个列有就算?同样情况还有3个壹列,上面都没有说清楚,所以我的代码是按全部算的。自己理清思路,如果只是其中一个对应自己看看怎么改改代码
5楼
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
6楼
有点蓝 发表于:2024/8/28 9:55:00
filter = filter & " or " & c.Name & " = '含'"

理解一下and和or的区别:http://www.foxtable.com/webhelp/topics/0102.htm
[此贴子已经被作者于2024/8/28 9:56:03编辑过]
7楼
185723664 发表于:2024/8/28 10:18:00
蓝大师,按上楼 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
8楼
有点蓝 发表于: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)
共8 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03906 s, 4 queries.