Foxtable(狐表)用户栏目专家坐堂 → 数据自动变化


  共有1543人关注过本帖树形打印复制链接

主题:数据自动变化

美女呀,离线,留言给我吧!
qinlao666
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:443 积分:3772 威望:0 精华:0 注册:2015/3/3 10:06:00
数据自动变化  发帖心情 Post By:2016/5/25 20:27:00 [只看该作者]

请教老师,如图

后面一栏的数据是随前面一栏的数据变化而变化的,且每一横行没有任何的关联

请问有没有简洁的命令实现我的想法,而不是像我这样一个一个的写,因为有好几十个这样的数据,请老师赐教,谢谢
If e.DataCol.Name = "介质名称" Then
    If e.NewValue Is Nothing Then
        e.DataRow("介质名称英文") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("泵电机参数").Find("[介质名称] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            e.DataRow("介质名称英文") = dr("介质名称英文")
        End If
    End If
End If

If e.DataCol.Name = "螺杆数量" Then
    If e.NewValue Is Nothing Then
        e.DataRow("螺杆轴数量英文") = Nothing
        e.DataRow("螺杆轴数量代码") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("泵电机参数").Find("[螺杆轴数量] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            e.DataRow("螺杆轴数量英文") = dr("螺杆轴数量英文")
            e.DataRow("螺杆轴数量代码") = dr("螺杆轴数量代码")
        End If
    End If
End If

If e.DataCol.Name = "压力范围" Then
    If e.NewValue Is Nothing Then
        e.DataRow("压力范围英文") = Nothing
        e.DataRow("压力范围代码") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("泵电机参数").Find("[压力范围] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            e.DataRow("压力范围英文") = dr("压力范围英文")
            e.DataRow("压力范围代码") = dr("压力范围代码")
        End If
    End If
End If

 回到顶部
美女呀,离线,留言给我吧!
qinlao666
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:443 积分:3772 威望:0 精华:0 注册:2015/3/3 10:06:00
  发帖心情 Post By:2016/5/25 20:33:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20160525202918.jpg
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/25 20:40:00 [只看该作者]

Dim cs1() As String = {"介质名称","螺杆数量"}
Dim cs2() As String = {"介质名称","螺杆轴数量"}
Dim idx As Integer = array.indexof(cs1, e.DataCol.name)
If idx >= 0 Then
    Dim dr = DataTables("泵电机参数").Find(cs2(idx) & " = '" & e.NewValue & "'")
    Dim n1 As String = cs2(idx) & "英文"
    Dim n2 As String = cs2(idx) & "代码"
    If dr Is Nothing Then
        If e.DataTable.datacols.contains(n1) Then e.DataRow(n1) = Nothing
        If e.DataTable.datacols.contains(n2) Then e.DataRow(n2) = Nothing
    Else
        If e.DataTable.datacols.contains(n1) Then e.DataRow(n1) = dr(n1)
        If e.DataTable.datacols.contains(n2) Then e.DataRow(n2) = dr(n2)
    End If
End If

 回到顶部