以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  最大数  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=190862)

--  作者:良才
--  发布时间:2024/3/8 14:10:00
--  最大数
Dim max As String
max = DataTables("机器入库").Compute("Max(批次)", "Year(采购日期)=#" & Year(e.DataRow("采购日期")) & "# And 机器孔数=\'" & e.DataRow("机器孔数") & "\'")
Output.Show(max)
请老师指教

--  作者:有点蓝
--  发布时间:2024/3/8 14:27:00
--  
参考:http://www.foxtable.com/webhelp/topics/2720.htm
[此贴子已经被作者于2024/3/8 14:28:05编辑过]

--  作者:良才
--  发布时间:2024/3/8 14:31:00
--  
老师提示错误
Se lect e.DataCol.Name
    Case "采购日期", "机器孔数"
        If e.DataRow.IsNull("采购日期") OrElse e.DataRow.IsNull("机器孔数") Then
            e.DataRow("批次") = Nothing
        Else
            Dim bh As String = Format(e.DataRow("采购日期"), "yyyy") & "-" & e.DataRow("机器孔数") & "-"
            If e.DataRow("批次").StartsWith(bh) = False Then
                Dim max As String
                Dim idx As Integer
                max = e.DataTable.Compute("Max(批次)", "Year(采购日期)=" & e.DataRow("采购日期").year & " And 机器孔数=\'" & e.DataRow("机器孔数") & "\'And [_Identify] <> " & e.DataRow("_Identify"))
                If max > "" Then
                    idx = CInt(max.Substring(8, 2)) + 1
                Else
                    idx = 1
                End If
                e.DataRow("批次") = bh & Format(idx, "00")
            End If
        End If
End Select

--  作者:有点蓝
--  发布时间:2024/3/8 14:50:00
--  

--  作者:良才
--  发布时间:2024/3/8 21:06:00
--  
谢谢