以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]如何获取遍历之后符合条件的行的数量!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=125975)

--  作者:lunengcheng
--  发布时间:2018/10/11 9:27:00
--  [求助]如何获取遍历之后符合条件的行的数量!
各位老师前辈,有下面这段代码,现在需要定义一个值,这个值等于遍历所有行之后,符合条件的行的数量,也就是返回("Select")=True的行数,自己写了代码写不对,特请教一下大家,多谢了!

Dim t As Table= Tables(eform.name & "_Table1")
\'停止绘制
t.StopRedraw()
For i As Integer = t.Rows.count-1 To 0 Step -1
    Dim r = t.Rows(i)
    If r("Select")=True Then

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

方法一

 

Dim t As Table= Tables(e.form.name & "_Table1")
\'停止绘制
t.StopRedraw()
Dim count As Integer = 0
For i As Integer = t.Rows.count-1 To 0 Step -1
    Dim r = t.Rows(i)
    If r("Select")=True Then
        count += 1

[此贴子已经被作者于2018/10/11 9:29:34编辑过]

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

方法二

 


Dim t As Table = Tables(e.form.name & "_Table1")
Dim count = t.Compute("count(select)", "Select = true")


--  作者:lunengcheng
--  发布时间:2018/10/11 9:33:00
--  
ok,解决了,多谢老师!