以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122806)

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

140个账号信息;如果正常完成的不够,先把正常完成的选择,再从“填答检测”中过快提交的选择一定数量,凑够140行即可。请问这个如何在狐表中实现?非常感谢
--  作者:有点甜
--  发布时间: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