Foxtable(狐表)用户栏目专家坐堂 → 考勤相同小时排除


  共有1576人关注过本帖树形打印复制链接

主题:考勤相同小时排除

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/8 17:04:00 [显示全部帖子]

参考代码

 

Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第一列,第二列"
For Each dr As DataRow In DataTables("表A").Select("", cs)
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        If pdr("第一列") <> dr("第一列") OrElse format(pdr("第二列"),"yyyyMMddHH") <> format(dr("第二列"), "yyyyMMddHH")  Then
            flag = True
        End If
    End If
    If flag Then
        If count > 1 Then
            idx &= idx_temp
        End If
        count = 1
        idx_temp = ""
    Else
        count += 1
        idx_temp &= dr("_Identify") & ","
    End If
   
    pdr = dr
Next

If count > 1 Then
    idx &= idx_temp
End If

'Tables("表A").filter = "_Identify in (" & idx.trim(",") & ")"
Tables("表A").filter = "_Identify not in (" & idx.trim(",") & ")"


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/9 15:28:00 [显示全部帖子]

Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第一列,第二列"
For Each dr As DataRow In DataTables("表A").Select("", cs)
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        Dim sp As TimeSpan = dr("第二列") - pdr("第二列")
        If pdr("第一列") <> dr("第一列") OrElse sp.TotalMinutes >= 5  Then
            flag = True
        End If
    End If
    If flag Then
        If count > 1 Then
            idx &= idx_temp
        End If
        count = 1
        idx_temp = ""
    Else
        count += 1
        idx_temp &= dr("_Identify") & ","
    End If
   
    pdr = dr
Next

If count > 1 Then
    idx &= idx_temp
End If

Tables("表A").filter = "_Identify in (" & idx.trim(",") & ")"
'Tables("表A").filter = "_Identify not in (" & idx.trim(",") & ")"


 回到顶部