Foxtable(狐表)用户栏目专家坐堂 → 转置后的临时表怎么用


  共有14706人关注过本帖平板打印复制链接

主题:转置后的临时表怎么用

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


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

Dim g As New CrossTableBuilder("成绩转置", DataTables("成绩登记表"))
g.HGroups.AddDef("考试期数")
g.HGroups.AddDef("班级")
g.HGroups.AddDef("学号")
g.HGroups.AddDef("姓名")
g.VGroups.AddDef("课程名称")
g.Totals.AddDef("分数", "分数")
g.HorizontalTotal = True
g.Build()
MainTable = Tables("成绩转置")
Tables("成绩转置").grid.Cols("合计").caption = "总分"
Dim dic As new Dictionary(of String, String)
For Each c As Col In Tables("成绩转置").cols
dic.add(c.caption, c.name)
Next
'---------------------------------
Dim fsd As New List(of Integer)
For Each r1 As Row In Tables("自定义统计分数段").Rows
    If r1.Checked Then
        fsd.add(r1("分数段"))
    End If
Next
If fsd.count> 0 Then
    fsd.sort
    Dim dtb As New DataTableBuilder("统计")
    dtb.AddDef("班级", Gettype(String))
    dtb.AddDef("科目", Gettype(String), 32)
    For Each fs As Integer In fsd
        dtb.AddDef(fs & "分" & iif(fs = fsd(0), "以下","以上") , Gettype(Integer))
    Next
    dtb.Build()
End If

Dim flt As String
Dim dt As DataTable =DataTables("成绩转置")
Dim t1 As Table =Tables("统计")
t1.StopRedraw

Dim bjs As List(of String) = dt.GetUniqueValues("","班级")
For Each flt In bjs
    Dim f As New Filler
    f.SourceTable =DataTables("科目表")
    f.DataTable = t1.DataTable   
    f.Fill()
    t1.DataTable.ReplaceFor("班级",flt,"班级 Is null")
Next

For Each dc As Col In t1.Cols
    If dc.Index > 1 Then
        For Each dr As Row In t1.Rows
            flt = "班级 = '" & dr("班级") & "' And " & dic(dr("科目"))
            If dc.Index =2 Then
                flt+ = " < "  &  dc.name.split("分")(0)
            ElseIf dc.Index =Tables("统计").Cols.count -1 Then
                flt+ = " >= "  &  dc.name.split("分")(0)
            Else
                flt+ = " >= " &  dc.name.split("分")(0) & " And " & dic(dr("科目")) & " < " & t1.Cols(dc.Index+1).Name.split("分")(0)
            End If
            dr(dc.name) =dt.Compute("Count(姓名)",flt)
        Next
    End If
Next

t1.DataTable.SysStyles("EmptyArea").BackColor = Color.White
t1.ResumeRedraw
MainTable = t1


 回到顶部
总数 170 1 2 3 4 5 6 7 8 9 10 下一页 ..17