Foxtable(狐表)用户栏目专家坐堂 → 如何写班级的排名公式


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

主题:如何写班级的排名公式

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


加好友 发短信 F6
等级:狐精 帖子:3036 积分:19223 威望:0 精华:2 注册:2008/9/1 7:50:00
  发帖心情 Post By:2008/11/12 9:06:00 [显示全部帖子]

以下是引用狐狸爸爸在2008-11-12 8:22:00的发言:
呵呵,我怎么测试才一秒左右啊。
用下面的代码应该好一点。
还有要注意不是所有的列都应该设置成双精度型,排名、班级、学号这样的列应该是整数型。

e.Form.Controls("Label1").text="请稍等,正在计时..."

dim timestart,timeend as date

timestart=date.now

Dim pm As List(Of String) = CurrentTable.DataTable.GetUniqueValues("","班级")

Dim pmc As Integer

Dim ColNames() As String = {"数学","英语","化学","物理","总分"}

Dim TotalName As String

CurrentTable.Redraw = False '刷新表

For Each ColName As string In ColNames

    For i As Integer = 0 To pm.Count -1

        CurrentTable.Filter= "[班级] = '" & pm(i) & "'"

        Currenttable.sort = ColName & " DESC"

        pmc = 0

        TotalName = ColName & "班级排名"

        For n As integer = 0 to Currenttable.rows.Count -1

            pmc = pmc +1

            If n > 0 AndAlso Currenttable.rows(n)(TotalName ) = Currenttable.rows(n-1)(TotalName ) Then

                CurrentTable.Rows(n)(TotalName ) = CurrentTable.Rows(n-1)(TotalName )

            Else

                CurrentTable.Rows(n)(TotalName ) = pmc

            End If

        Next

    Next

Next

Tables("学生各科成绩表").Sort = "总分 DESC" '排序,对总分列以降序排序

CurrentTable.Filter = "" '取消筛选

CurrentTable.Redraw = True '刷新表

timeend=date.now

e.Form.Controls("Label1").text="耗时" & (timeend-timestart).TotalSeconds & ""

Messagebox.Show("统计完毕!")



 下载信息  [文件大小:127.3 KB  下载次数:1]
点击浏览该文件:学生成绩统计分析表.rar

[此贴子已经被作者于2008-11-12 8:25:52编辑过]

一个字 好


 回到顶部