Foxtable(狐表)用户栏目专家坐堂 → [求助]


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

主题:[求助]

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


加好友 发短信
等级:婴狐 帖子:2 积分:80 威望:0 精华:0 注册:2018/8/2 3:31:00
[求助]  发帖心情 Post By:2018/8/2 13:44:00 [只看该作者]

求助:各位专家,这是我导入狐表的部分信息,我需要根根据“填答检测”中正常完成的随机抽取不同高校的
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:本科账号固定选取180802.xlsx

140个账号信息;如果正常完成的不够,先把正常完成的选择,再从“填答检测”中过快提交的选择一定数量,凑够140行即可。请问这个如何在狐表中实现?非常感谢

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/8/2 15:43:00 [只看该作者]

代码

 

Dim dt As DataTable = DataTables("test")
dt.ResumeRedraw
dt.StopRedraw
Dim xxmcs = dt.getvalues("学校名称", "学校名称 is not null")
Dim ls_drs As new List(of object)
dt.ReplaceFor("选择", False)
For Each xxmc As String In xxmcs
    Dim drs = dt.Select("学校名称 = '" & xxmc & "' and 填答检测 = '正常完成'")
    Dim ls_dr As new List(of DataRow)
    If drs.count >= 140 Then
        Dim cnt = drs.count-1
        Dim ids As new List(of Integer)
        For i As Integer = 0 To cnt
            ids.Add(i)
        Next
        For i As Integer = 0 To cnt*5 '洗牌次数
            Dim id1 As Integer = rand.Next(0,cnt)
            Dim id2 As Integer = rand.Next(0,cnt)
            Dim vid As Integer = ids(id1)
            ids(id1) = ids(id2)
            ids(id2) = vid
        Next
       
        For i As Integer = 0 To 140-1
            ls_dr.add(drs(ids(i)))
        Next
    Else
        For Each dr As DataRow In drs
            ls_dr.add(dr)
        Next
        drs = dt.Select("学校名称 = '" & xxmc & "' and 填答检测 = '过快提交'")
        Dim cnt = drs.count-1
        Dim ids As new List(of Integer)
        For i As Integer = 0 To cnt
            ids.Add(i)
        Next
        For i As Integer = 0 To cnt '洗牌次数
            Dim id1 As Integer = rand.Next(0,cnt)
            Dim id2 As Integer = rand.Next(0,cnt)
            Dim vid As Integer = ids(id1)
            ids(id1) = ids(id2)
            ids(id2) = vid
        Next
        If drs.count + ls_dr.count >= 140
            For i As Integer = 0 To 140-ls_dr.count-1
                ls_dr.add(drs(ids(i)))
            Next
        Else
            For Each dr As DataRow In drs
                ls_dr.add(dr)
            Next
        End If
    End If
    output.show(xxmc & ls_dr.count)
    ls_drs.add(ls_dr)
Next
For Each ls_dr As object In ls_drs
    For Each dr As DataRow In ls_dr
        dr("选择") = True
        'output.show(Date.now)
    Next
Next
'Tables("test").filter = "选择 = true"
dt.ResumeRedraw

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目33.rar


 回到顶部