以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 多条件求和 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=185142) |
-- 作者:nuoyan89 -- 发布时间:2023/2/7 10:46:00 -- 多条件求和 老师,我用多条件求和(如图1),代码如下,求出来后,我把使用类型清空后,计算的结果:“加工数量”不清空(如图2),因为条件都不全的,正常的话"加工数量"的结果应该要清空才对! If e.DataRow("使用类型") = "按设备算" Then If e.DataCol.Name = "使用设备" Or e.DataCol.Name = "月份" Then If e.DataRow.isnull("使用设备") OrElse e.DataRow.isnull("月份") Then e.DataRow("加工数量") = Nothing Else e.DataRow("加工数量") = DataTables("工序跟踪表").sqlCompute("sum(加工时间)", "[使用设备] = \'" & e.DataRow("使用设备") & "\' and 月份 = \'" & e.DataRow("月份") & "\'") End If End If Else If e.DataCol.Name = "月份" Then If e.DataRow.isnull("月份") Then e.DataRow("加工数量") = Nothing Else e.DataRow("加工数量") = DataTables("工序跟踪表").sqlCompute("sum(加工时间)", "[月份] = \'" & e.DataRow("月份") & "\'") End If End If End If |
-- 作者:有点蓝 -- 发布时间:2023/2/7 10:54:00 -- 把这个代码的判断逻辑使用文字表达一下 |