以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 加条件问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=187988) |
-- 作者:lin98 -- 发布时间:2023/8/25 10:45:00 -- 加条件问题 表A的字段:单号,料号,品名,数量,日期,审核 下面代码,是否可以加条件,按表A的a.审核=\'未审核\' and a.审核=\'\',开始日期、结束日期,表A数量=SUM(表A数量)? Dim Vals3 As List(Of String()) Vals3 = DataTables("表A").GetValues("单号|料号|品名|数量")\' For r As Integer = 0 To Vals3.Count - 1 Dim dr3 As DataRow = DataTables("表D").find("订单单号=\'" & Vals3(r)(0) & "\'and 产品编号=\'" & Vals3(r)(1) & "\'")\' If dr3 Is Nothing Then dr3 = DataTables("表D").AddNew()\'接收表 dr3("单号") = Vals3(r)(0)\' dr3("料号") = Vals3(r)(1)\' dr3("品名") = Vals3(r)(2)\' dr3("表A数量") = Vals3(r)(3)\' End If dr3("单号") = Vals3(r)(0)\' dr3("料号") = Vals3(r)(1)\' dr3("品名") = Vals3(r)(2)\' dr3("表A数量") = Vals3(r)(3)\' Next |
-- 作者:有点蓝 -- 发布时间:2023/8/25 11:07:00 -- http://www.foxtable.com/webhelp/topics/2747.htm,看示例四,五 |
-- 作者:lin98 -- 发布时间:2023/8/25 16:30:00 -- Dim Vals3 As List(Of String()) Vals3 = DataTables("表A").GetValues("单号|料号|品名|数量","[审核]<> \'已审核\' ")\' For r As Integer = 0 To Vals3.Count - 1 Dim dr3 As DataRow = DataTables("表D").find("订单单号=\'" & Vals3(r)(0) & "\'and 产品编号=\'" & Vals3(r)(1) & "\'")\' If dr3 Is Nothing Then dr3 = DataTables("表D").AddNew()\'接收表 dr3("单号") = Vals3(r)(0)\' dr3("料号") = Vals3(r)(1)\' dr3("品名") = Vals3(r)(2)\' dr3("表A数量") = Vals3(r)(3)\' End If dr3("单号") = Vals3(r)(0)\' dr3("料号") = Vals3(r)(1)\' dr3("品名") = Vals3(r)(2)\' dr3("表A数量") = Vals3(r)(3)\' Next 问题一:执行上面代码,只显示"单号、数量的数据,没有"单号|料号|品名|数量,是什么问题? 问题二:需求的条件是取表A的审核列不是已审核的数据,表A的审核列有已审核、未审核、空值,下面代码无法实现 Vals3 = DataTables("表A").GetValues("单号|料号|品名|数量","[审核]<> \'已审核\' ")\' Vals3 = DataTables("表A").GetValues("单号|料号|品名|数量","[审核]<> \'已审核\'AND [审核]<> \'\'")\' 问题三:蓝色代码二个写法都一样,是一样的意思? |
-- 作者:有点蓝 -- 发布时间:2023/8/25 16:40:00 -- Vals3 = DataTables("表A").GetValues("单号|料号|品名|数量","[审核]= \'未审核\' or [审核] is null")\' |