以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求助  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=70628)

--  作者:xiaohuli
--  发布时间:2015/6/25 12:31:00
--  求助

  flt = "a编码 = \'"& e.DataRow("a编码") & "\' And "b编码 = \'"& e.DataRow("b编码") & "\' And "c编码 = \'"& e.DataRow("c编码") & "\'   And [_Identify] <> " & e.DataRow("_Identify")
                max = e.DataTable.Compute("Max(单据编码)",flt) \'取得该列别的最大单据编号

 

flt好像写错了,请大家帮忙看看。哪里有错。


--  作者:y2287958
--  发布时间:2015/6/25 12:40:00
--  
 flt = "a编码 = \'" & e.DataRow("a编码") & "\' And b编码 = \'" & e.DataRow("b编码") & "\' And c编码 = \'" & e.DataRow("c编码") & "\' And [_Identify] <> " & e.DataRow("_Identify")

试试

--  作者:xiaohuli
--  发布时间:2015/6/25 13:57:00
--  

我想实现如下的编号,a编码,b编码,c编码,顺序码

编码是根据a编码+b编码+c编码+顺序码得到的,但顺序码是随a、b、c编码变动自动+1。(顺序码是三位,001开始)如何编写这个顺序码。

eg:a  b  c  顺序码

      1  0  01   001 

      1  0  01   002 

      1  0  02   001 

      2  0  01   001

 顺序码根据a,b,c编码变动自动加1 。


--  作者:大红袍
--  发布时间:2015/6/25 14:30:00
--  

datacolchanged事件

 

Select Case e.DataCol.Name
    Case "第一列", "第二列", "第三列"
        Dim  max As String
        Dim  idx As  Integer
        max = e.DataTable.Compute("Max(第五列)"," 第一列 = \'" & e.DataRow("第一列") & "\' and 第二列 = \'" & e.DataRow("第二列") & "\' and 第三列 = \'" & e.DataRow("第三列") & "\' and [_Identify] <> " & e.DataRow("_Identify"))
        If  max > "" Then \'如果存在最大编号
            idx = CInt(max.Substring(0,3)) + 1  \'获得最大编号的后三位顺序号,并加1
            e.DataRow("第五列") = Format(idx,"000")
           
        Else
            e.DataRow("第五列") = "001"
        End  If
End Select


--  作者:xiaohuli
--  发布时间:2015/6/25 15:00:00
--  

我想实现如下的编号,a编码,b编码,c编码,顺序码,编码

编码是根据a编码+b编码+c编码+顺序码得到的,现在编码都能得到,但是当a/b/c编码变动的时候,编码还是

第一次得到的那个编码,编码不变,我是想实现,如果a/b/c编码变动的话,编码也能变动。代码如下,请大神帮我看看。

  Case "a编码","b编码","c编码","顺序号"
        Dim dr  As  DataRow = e.DataRow
        Dim pr  As  DataRow
        If   dr.IsNull("a编码") OrElse dr.IsNull("b编码") OrElse dr.IsNull("c编码")  OrElse dr.IsNull("顺序号")   Then
            dr("编码") =  Nothing
        Else
            
        
            e.DataRow("编码")=  e.DataRow("a编码") &  e.DataRow("b编码") &  e.DataRow("c编码") &  e.DataRow("顺序号")
        End If


--  作者:大红袍
--  发布时间:2015/6/25 15:11:00
--  
 

Select Case e.DataCol.Name
    Case "第一列", "第二列", "第三列"
        Dim  max As String
        Dim  idx As  Integer
        max = e.DataTable.Compute("Max(第五列)"," 第一列 = \'" & e.DataRow("第一列") & "\' and 第二列 = \'" & e.DataRow("第二列") & "\' and 第三列 = \'" & e.DataRow("第三列") & "\' and [_Identify] <> " & e.DataRow("_Identify"))
        If  max > "" Then \'如果存在最大编号
            idx = CInt(max.Substring(0,3)) + 1  \'获得最大编号的后三位顺序号,并加1
            e.DataRow("第五列") = Format(idx,"000")
           
        Else
            e.DataRow("第五列") = "001"
        End  If

        e.DataRow("第七列")=  e.DataRow("第一列") &  e.DataRow("第二列") &  e.DataRow("第三列") &  e.DataRow("第五列")
End Select