以文本方式查看主题

-  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=118931)

--  作者:liuandwang
--  发布时间:2018/5/14 17:02:00
--  空值列隐藏
求助各位老师:
我做了一个订单结算窗口,绑定订单表,绑定表属性为副本,
在绑定表设计了显示列,想在列名为:高、宽、左宽等列进行空值隐藏,
看了文件帮助,但不知道怎么改下面的窗口事件afterload代码。

For Each c As Col In Tables("订单结算_table1").Cols
    Dim fdr As DataRow = c.Table.DataTable.Find(c.name & " is not null")
    If fdr IsNot Nothing Then
        c.Visible = True
    Else
        c.Visible = False
    End If
Next

--  作者:有点甜
--  发布时间:2018/5/14 17:10:00
--  

For Each c As Col In Tables("订单结算_table1").Cols
    Select Case c.name
        Case "高", "宽", "左宽"
            Dim fdr As DataRow = c.Table.DataTable.Find(c.name & " is not null")
            If fdr IsNot Nothing Then
                c.Visible = True
            Else
                c.Visible = False
            End If
    End Select
Next

--  作者:liuandwang
--  发布时间:2018/5/15 11:02:00
--  
问题解决了,谢谢
--  作者:liuandwang
--  发布时间:2018/5/15 15:26:00
--  自动编号问题
甜老师:

关于自动编号的问题,我想实现一个订单编号对应一个客户,一个客户有可能有多条记录需求,
客户不变订单编号不变:
编号1     客户1     内容1
编号1     客户1     内容2
编号2     客户2     内容3
编号3     客户3     内容4
编号4     客户1     内容5

在表事件datacolchanged中采用如下代码,编号(1805FD-001)不增加,关机后编号消失,甜老师帮忙给改一下,谢谢

If e.DataCol.Name = "接单日期" Then
    If e.DataRow.IsNull("接单日期") Then
        e.DataRow("订单编号") = Nothing
    Else
        Dim d As Date = e.DataRow("接单日期")
        Dim y As Integer = d.Year
        Dim m As Integer = d.Month
        Dim Days As Integer = Date.DaysInMonth(y,m)
        Dim fd As Date = New Date(y,m,1) \'获得该月的第一天
        Dim ld As Date = New Date(y,m,Days) \'获得该月的最后一天
        Dim bh As String = Format(d,"yyMM") \'生成编号的前6位,4位年,2位月.
        If e.DataRow("订单编号").StartsWith(bh) = False \'如果编号的前6位不符
          Dim fdr As DataRow = e.DataTable.find("接单日期 = #" & e.DataRow("接单日期") & "# and 客户名称 = \'" & e.DataRow("客户名称") & "\' and 订单编号 is not null And [_Identify] <> " & e.DataRow("_Identify"))
            If fdr IsNot Nothing Then
                e.DataRow("订单编号") = fdr("订单编号")
            Else
                Dim max As String
                Dim idx As Integer
                max = e.DataTable.Compute("Max(订单编号)","接单日期 = #" & e.DataRow("接单日期") & "# And [_Identify] <> " & e.DataRow("_Identify")) \'取得该天的最大编号
                If max > "" Then \'如果存在最大编号
                    idx = CInt(max.Substring(7,3)) + 1 \'获得最大编号的后三位顺序号,并加1
                Else

                    idx = 1 \'否则顺序号等于1
                End If
                e.DataRow("订单编号") = bh & "FD-" & Format(idx,"000")
            End If
        End If
    End If
End If
       

--  作者:有点甜
--  发布时间:2018/5/15 15:35:00
--  

没看懂你这个逻辑。如果一个用户有多条记录,应该做一个 订单表、一个订单明细表的。

 

订单表输入一行数据,在明细表那里随意再添加任意多行记录。


--  作者:liuandwang
--  发布时间:2018/5/17 8:58:00
--  
想多了,简单问题复杂化了,谢谢甜老师指导