以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]行加载的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=147094)

--  作者:HANZHIGANG
--  发布时间:2020/3/9 20:42:00
--  [求助]行加载的问题

窗口1绑定总表的两个副本,想实现双击副本1的某行时,该行在副本中被移除,而加载到副本2中

请老师指导代码

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


--  作者:有点蓝
--  发布时间:2020/3/9 21:19:00
--  
Table1双击事件

Dim Filter As String = "_Identify = " & e.Row("_Identify")
Dim Filter2 As String = "_Identify <> " & e.Row("_Identify")

If e.Table.Filter > "" Then
    e.Table.Filter = e.Table.Filter & " and " & Filter2
Else
    e.Table.Filter = Filter2
End If

If Tables("窗口1_Table2").Filter= "False" Then
    Tables("窗口1_Table2").Filter=filter
Else
    Tables("窗口1_Table2").Filter= Tables("窗口1_Table2").Filter & " or " & filter
End If

e.Cancel = True

--  作者:HANZHIGANG
--  发布时间:2020/3/9 21:50:00
--  
谢老师,第一个问题用您的代码已解决了
但有另一个问题,,就是成功的从副本1加载到副本2的行,想再从副本2中返加载回副本1,同时副本2移除
我将代码中的table2全部改为table1,好像不行,有的移回去后,副本1、2就都有这条信息了,有的行根本没反应
所以请老师再指导
[此贴子已经被作者于2020/3/9 21:50:41编辑过]

--  作者:有点蓝
--  发布时间:2020/3/9 22:11:00
--  
换种方式,添加1个集合类型的全局变量。table1双击的时候把id加入集合,table2双击的时候把id从集合移除

然后table1筛选的时候排除集合里的id:Tables("窗口1_Table1").Filter ="_Identify not in (" & string.join(",",集合变量.toarray) & ")"

table2筛选取集合的id:Tables("窗口1_Table2").Filter ="_Identify in (" & string.join(",",集合变量.toarray) & ")"

--  作者:HANZHIGANG
--  发布时间:2020/3/10 20:48:00
--  
弄了一下午,没整明白,还请老师帮贴代码吧(感觉太麻烦老师了)
--  作者:有点蓝
--  发布时间:2020/3/10 21:13:00
--  
窗口afterload
vars("ids") = new List(of string)

table1双击事件
Dim id As Integer = e.Row("_Identify")
If vars("ids").contains(id) = False Then
    vars("ids").add(id)
End If
Dim Filter As String = "_Identify not in (" & String.join(",",vars("ids")..toarray) & ")"
Dim Filter2 As String = "_Identify in (" & String.join(",",vars("ids")..toarray) & ")"

e.Table.Filter = Filter 
Tables("窗口1_Table2").Filter = Filter2 
e.Cancel = True

table2双击事件
Dim id As Integer = e.Row("_Identify")
If vars("ids").contains(id) Then
    vars("ids").remove(id)
End If
Dim Filter As String = "_Identify not in (" & String.join(",",vars("ids")..toarray) & ")"
Dim Filter2 As String = "_Identify in (" & String.join(",",vars("ids")..toarray) & ")"

e.Table.Filter = Filter2 
Tables("窗口1_Table1").Filter = Filter
e.Cancel = True


--  作者:HANZHIGANG
--  发布时间:2020/3/11 18:08:00
--  [求助]加载问题
老师,双击后出现了错误提示
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


--  作者:HANZHIGANG
--  发布时间:2020/3/12 6:40:00
--  
实在不好意思,麻烦老师帮看一下
--  作者:有点蓝
--  发布时间:2020/3/12 12:02:00
--  
table1双击事件

Dim id As String = e.Row("_Identify")
If vars("ids").contains(id) = False Then
    vars("ids").add(id)
End If
Dim lst As List(of String) = vars("ids")
Dim Filter As String = "_Identify not in (" & String.join(",",lst.ToArray) & ")"
Dim Filter2 As String = "_Identify in (" & String.join(",",lst.ToArray) & ")"

e.Table.Filter = Filter 
Tables("窗口1_Table2").Filter = Filter2 
e.Cancel = True

table2双击事件
Dim id As String = e.Row("_Identify")
If vars("ids").contains(id) Then
    vars("ids").remove(id)
End If
Dim lst As List(of String) = vars("ids")
If lst .count > 0 Then
    Dim Filter As String = "_Identify not in (" & String.join(",",lst .ToArray) & ")"
    Dim Filter2 As String = "_Identify in (" & String.join(",",lst .ToArray) & ")"

    e.Table.Filter = Filter2
    Tables("窗口1_Table1").Filter = Filter
Else
    e.Table.Filter = "false"
    Tables("窗口1_Table1").Filter = ""
End If
e.Cancel = True

--  作者:HANZHIGANG
--  发布时间:2020/3/12 12:15:00
--  感谢
完美实现
感谢老师不厌其烦的指导
为你们的产品点赞
为你们的服务点赞
再次感谢