以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  行的统计  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=176961)

--  作者:foxtablefanse
--  发布时间:2022/5/5 8:13:00
--  行的统计
出勤天数:√ 算 1天 ;√/休 算0.5天;休/√算0.5天。
除了遍历行遍历列,还有其它统计方法吗?

图片点击可在新窗口打开查看此主题相关图片如下:出勤天数.jpg
图片点击可在新窗口打开查看



--  作者:有点蓝
--  发布时间:2022/5/5 8:48:00
--  
没有其它办法
--  作者:foxtablefanse
--  发布时间:2022/5/5 10:59:00
--  
 For Each dr3 As Row In Tables("KQ").Rows
        Dim ts As Integer=0
        For Each c As Col In Tables("KQ").Cols
            If c.name = "姓名" OrElse  c.name = "出勤天数"
                Continue For
            Else
                ts += iif(dr3(c.name)="√",1,iif(dr3(c.name)="休/√",0.5,iif(dr3(c.name)="√/休",0.5,0)))
            End If
        Next
        dr3("出勤天数")=ts
        ts=0
    Next
这样写怎么不行呢??

--  作者:有点蓝
--  发布时间:2022/5/5 11:05:00
--  
调试一下

For Each dr3 As Row In Tables("KQ").Rows
        Dim ts As Integer=0
        For Each c As Col In Tables("KQ").Cols
            If c.name = "姓名" OrElse  c.name = "出勤天数"
                Continue For
            Else
dim d as double = iif(dr3(c.name)="√",1,iif(dr3(c.name)="休/√",0.5,iif(dr3(c.name)="√/休",0.5,0)))
msgbox(c.name & "," & dr3(c.name) & "," & d)
                ts += d
            End If
        Next
        dr3("出勤天数")=ts
        ts=0
    Next

--  作者:foxtablefanse
--  发布时间:2022/5/5 11:18:00
--  
谢谢!基础太差,数据类型搞错了!!!
[此贴子已经被作者于2022/5/5 11:18:34编辑过]