Foxtable(狐表)用户栏目专家坐堂 → 交叉统计中如何进行水平分类汇总


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

主题:交叉统计中如何进行水平分类汇总

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


加好友 发短信
等级:八尾狐 帖子:1812 积分:12993 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2014/4/3 17:41:00 [显示全部帖子]

Dim g As New CrossTableBuilder("统计表", DataTables("学时2013下"))
g.HGroups.AddDef("xq")
g.HGroups.AddDef("zsbh")
g.HGroups.AddDef("xm")
g.VGroups.AddDef("jzfjz")
g.VGroups.AddDef("djnf")
g.VGroups.AddDef("xmmc")
g.Totals.AddDef("xs")
g.HorizontalTotal =1
g.VerticalTotal =1
g.Filter = "xq is not null"
g.Build()

Dim ex1,ex2,s1,s2,s3 As String
Dim dt As DataTable = DataTables("统计表")
dt.StopRedraw


For Each dc As DataCol In dt.DataCols
    If dc.Caption.StartsWith("非集中_") Then
        ex1+= "+IsNull([" & dc.name & "],0)"
        s1+= "|" & dc.name & "|-1"
    Else If dc.Caption.StartsWith("集中_") Then
        ex2+= "+IsNull([" & dc.name & "],0)"
        s2+= "|" & dc.name & "|-1"
    End If
Next

s3="xq|-1|zsbh|-1|xm|-1" 
If ex1 isnot nothing then
    dt.DataCols.Add("非集中小计", Gettype(Integer),ex1.trim("+"))
    s3+= s1 & "|非集中小计|-1"
End if
If ex2 isnot nothing then
    dt.DataCols.Add("集中小计", Gettype(Integer),ex2.trim("+"))
    s3+ =s2 & "|集中小计|-1"
End if
s3+="|合计|-1"

Tables("统计表").SetColVisibleWidth(s3)
dt.ResumeRedraw
MainTable = Tables("统计表")
[此贴子已经被作者于2014-4-3 18:34:03编辑过]

 回到顶部