以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  统计空值的次数  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88967)

--  作者:zhangning
--  发布时间:2016/8/12 15:13:00
--  统计空值的次数
老师,有两个列“签到时间”和“签退时间”,我想
如果周一和周五,这两列中有一个是空的,就算未打卡1次,
                       如两列都是空的,就算未打卡2次
如是周六和周日,如一列有时间,另一列没有时间,则算未打卡1次,

请问老师,如何达到这种效果,
还有,统计空值次数的代码怎么写?

--  作者:大红袍
--  发布时间:2016/8/12 15:19:00
--  
Dim sum As Double = 0
For Each dr As DataRow In DataTables("表A").Select("")
    Dim d As Date = dr("第一列")
    If d.DayOfWeek = 0 OrElse d.DayOfWeek = 6 Then
        If dr.IsNull("第二列") OrElse dr.IsNull("第三列") Then
            sum = sum + 1
        End If
    Else
        If dr.IsNull("第二列") Then
            sum = sum + 1
        End If
        If dr.IsNull("第三列") then
            sum = sum + 1
        End If
    End If
Next
msgbox(sum)