以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  动态获取最后的日期  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91093)

--  作者:yifan3429
--  发布时间:2016/9/29 11:35:00
--  动态获取最后的日期
《将更新日期 更新的最新日期 更新到动态主表 对应的结束日期   例如流程为选择  深化 那么深化_结束日期
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:动态获取日期.foxdb

将获取更新的日期  流程为选择  发货 那么发货_结束日期 将获取更新的日期    还要注意关联订单号

--  作者:有点蓝
--  发布时间:2016/9/29 11:44:00
--  
参考:http://www.foxtable.com/webhelp/scr/1453.htm
--  作者:yifan3429
--  发布时间:2016/9/29 12:04:00
--  
我需要的条件和跨表更新的实例不一样  实例是列对列   我的是行对列  做了几次都不成功
--  作者:有点蓝
--  发布时间:2016/9/29 14:09:00
--  
道理一样的。贴出你的代码
--  作者:yifan3429
--  发布时间:2016/9/29 18:13:00
--  
If e.DataCol.Name = "订单号" Then
    If e.NewValue Is Nothing Then
        e.DataRow("深化_结束日期") = Nothing
        e.DataRow("发货_结束日期") = Nothing
        e.DataRow("备货_结束日期") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("动态明细").Find("[订单号] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
            Select Case Tables("动态明细").Current("流程") = "深化"
                \'e.DataRow("深化_结束日期") = dr("更新日期")
                Case "发货"
                    e.DataRow("发货_结束日期") = dr("更新日期")
                Case "备货"
                    e.DataRow("备货_结束日期") = dr("更新日期")
                    
            End Select
        End If
    End If
End If

--  作者:有点蓝
--  发布时间:2016/9/29 20:13:00
--  

If e.DataCol.Name = "订单号" Then
    If e.NewValue Is Nothing Then
        e.DataRow("深化_结束日期") = Nothing
        e.DataRow("发货_结束日期") = Nothing
        e.DataRow("备货_结束日期") = Nothing
    Else
        Dim drs As List(Of DataRow)
        
        drs = DataTables("动态明细").Select("[订单号] = \'" & e.NewValue & "\'")
        For Each dr As DataRow In drs
            e.DataRow(dr("流程") & "_结束日期") = dr("更新日期")
        Next
    End If
End If

--  作者:yifan3429
--  发布时间:2016/9/30 11:42:00
--  
上面代码方案发在 主表可以实现  我想我在子表输入新的进度流程时  父表对应的列更新数据  求助
[此贴子已经被作者于2016/9/30 11:42:22编辑过]

--  作者:有点蓝
--  发布时间:2016/9/30 14:02:00
--  
明细表DataColChanged

Select Case e.DataCol.Name
    Case "流程","更新日期"
        Dim dr As DataRow = DataTables("动态主表").Find("[订单号] = \'" & e.DataRow("订单号") & "\'")
        If dr IsNot Nothing Then
            dr(e.DataRow("流程") & "_结束日期") = e.DataRow("更新日期")
        End If
End Select