以文本方式查看主题
- Foxtable(狐表) (http://foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2)
---- 结果显示指定数值 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122430)
|
-- 作者:xinyu88
-- 发布时间:2018/7/25 13:25:00
-- 结果显示指定数值
老师,如果下面对应的结果等于1,则显示为指定的数值。不然显示为空白,这个怎么把它连起来呢?谢谢!
如果这个结果=1,显示为:1
Select Case e.DataCol.Name Case "加工工序","毛坯编码" Dim Filter3 As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\'" e.DataRow("完成数量") = DataTables("工序跟踪表").SQLCompute("Sum(合格品)", Filter3) e.DataRow.save End Select
如果这个结果=1,显示为:2 Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter3 As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today & "\' And 班次 = \'中班\'" e.DataRow("完成数量") = DataTables("每日排产").SQLCompute("Sum(加工数量)", Filter3) e.DataRow.save End Select
|
-- 作者:有点甜
-- 发布时间:2018/7/25 15:12:00
--
没看懂你表达的意思。这个意思?
Select Case e.DataCol.Name Case "加工工序","毛坯编码" Dim Filter3 As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\'" e.DataRow("完成数量") = DataTables("工序跟踪表").SQLCompute("Sum(合格品)", Filter3) If e.DataRow("完成数量") = 1 Then Else End If e.DataRow.save End Select
|
-- 作者:xinyu88
-- 发布时间:2018/7/25 15:23:00
--
就是说如果Select Case e.DataCol.Name Case "加工工序","毛坯编码" Dim Filter3 As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\'" e.DataRow("完成数量") = DataTables("工序跟踪表").SQLCompute("Sum(合格品)", Filter3) e.DataRow.save End Select求和的结果如是等于1,显示为指定数字:2,如果以下这个求和的结果=1,显示为数字3,以此类推,如图Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter3 As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today & "\' And 班次 = \'中班\'" e.DataRow("完成数量") = DataTables("每日排产").SQLCompute("Sum(加工数量)", Filter3) e.DataRow.save End Select 此主题相关图片如下:1.png
|
-- 作者:有点甜
-- 发布时间:2018/7/25 15:59:00
--
Select Case e.DataCol.Name Case "加工工序","毛坯编码" Dim Filter3 As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\'" e.DataRow("完成数量") = DataTables("工序跟踪表").SQLCompute("Sum(合格品)", Filter3) If e.DataRow("完成数量") = 1 Then e.DataRow("完成数量") = 2 Else e.DataRow("完成数量") = nothing End If e.DataRow.save End Select
|
-- 作者:xinyu88
-- 发布时间:2018/7/25 17:16:00
--
如图2是汇总表,如图1是明细表,为什么以下代码不能正常汇总呢?谢谢
Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today & "\' And 班次 = \'夜班\'" e.DataRow("完成数量") = DataTables("每日排产").SQLCompute("Sum(加工数量)", Filter)
If e.DataRow("完成数量") = 1 Then e.DataRow("完成数量") = 4 Else e.DataRow("完成数量") = Nothing End If e.DataRow.save End Select
此主题相关图片如下:1.png
此主题相关图片如下:2.png
|
-- 作者:有点甜
-- 发布时间:2018/7/25 17:20:00
--
1、弹出值看看
msgbox(DataTables("每日排产").SQLCompute("Sum(加工数量)", Filter))
2、修改filter的值,把条件改短一些,测试弹出是否正确。
|
-- 作者:xinyu88
-- 发布时间:2018/7/25 21:09:00
--
老师, Filter3带个3是什么意思呀?
|
-- 作者:有点甜
-- 发布时间:2018/7/25 21:21:00
--
改成这样弹出什么?是否正确?
Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter As String = ""
msgbox(DataTables("每日排产").SQLCompute("Sum(加工数量)", Filter))
filter = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today & "\' And 班次 = \'夜班\'"
msgbox(DataTables("每日排产").SQLCompute("Sum(加工数量)", Filter))
End Select
|
-- 作者:xinyu88
-- 发布时间:2018/7/25 21:38:00
--
老师,写了两段代码却只能求和一段代码的结果,如图1,但明细表里却有三个结果,如图2
Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today & "\' And 班次 = \'白班\'" e.DataRow("完成数量") = DataTables("每日排产").Compute("Sum(加工数量)", Filter) If e.DataRow("完成数量") = 1 Then e.DataRow("完成数量") = 2 Else e.DataRow("完成数量") = Nothing End If e.DataRow.save End Select Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today.adddays(1) & "\' And 班次 = \'白班\'" e.DataRow("完成数量") = DataTables("每日排产").Compute("Sum(加工数量)", Filter) If e.DataRow("完成数量") = 1 Then e.DataRow("完成数量") = 3 Else e.DataRow("完成数量") = Nothing End If e.DataRow.save End Select 此主题相关图片如下:1.jpg
此主题相关图片如下:2.jpg
|
-- 作者:有点甜
-- 发布时间:2018/7/25 23:10:00
--
Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today & "\' And 班次 = \'白班\'" e.DataRow("完成数量") = DataTables("每日排产").Compute("Sum(加工数量)", Filter) If e.DataRow("完成数量") = 1 Then e.DataRow("完成数量") = 2 End If e.DataRow.save End Select Select Case e.DataCol.Name Case "加工工序","毛坯编码","生产日期","班次" Dim Filter As String = "毛坯编码 = \'" & e.DataRow("毛坯编码") & "\' and 加工工序 = \'" & e.DataRow("加工工序") & "\' and 生产日期 = \'" & Date.Today.adddays(1) & "\' And 班次 = \'白班\'" e.DataRow("完成数量") = DataTables("每日排产").Compute("Sum(加工数量)", Filter) If e.DataRow("完成数量") = 1 Then e.DataRow("完成数量") = 3 End If e.DataRow.save End Select
|