以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  筛选的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=128015)

--  作者:蓝蚂蚁
--  发布时间:2018/11/27 10:21:00
--  筛选的问题


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

窗口中按钮的代码如下:

Tables("窗口_Table1").Filter = "张数 is null"
Dim t As Table = Tables("窗口_Table1")
For Each r As Row In t.rows
    Dim cn As Integer= Tables("出库单明细").Compute("Count(出库单号)","[出库单号] = \'" & r("出库单号")  & "\'")
    Dim Val As Double=cn/10
    Dim lng As Integer= Math.Ceiling(Val)
    r("张数")=lng
Next

说明:先筛选出张数是空的行,接着根据代码把张数填上。上面的代码执行后,窗口_Table1显示为空。我想要的是:填上张数之后,窗口_Table1显示的记录保持着原张数为空时一样。  


--  作者:有点甜
--  发布时间:2018/11/27 10:34:00
--  

改成这样

 

Dim t As Table = Tables("窗口_Table1")
Dim ids As String = t.DataTable.GetComboListString("_Identify", "张数 is null")
ids = "-1," & ids.Replace("|", ",")
ids = ids.trim(",")
t.Filter = "_Identify in (" & ids & ")"
For Each r As Row In t.rows
    Dim cn As Integer= Tables("出库单明细").Compute("Count(出库单号)","[出库单号] = \'" & r("出库单号")  & "\'")
    Dim Val As Double=cn/10
    Dim lng As Integer= Math.Ceiling(Val)
    r("张数")=lng
Next