以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  交叉统计的时间统计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=123251)

--  作者:susu312
--  发布时间:2018/8/10 16:10:00
--  交叉统计的时间统计

Dim nums1() As String={"sex","age","birth", _
"edu","workdate","politicalStatus", _
"retiredPost","title","leaOrRetire", _
"retireTime","proTecPost","partyTime", _
"organName","partyStanding","retiredDep"}
Dim nums2()  As String={"性别","年龄","出生年月", _
"学历","参加工作日期","政治面貌", _
"离退休职务","享受待遇","状态", _
"离退休时间","专业技术职务","入党时间", _
"单位","党龄","部门"}

 
 
Dim b As New SQLCrossTableBuilder("统计表1","person")
b.C
For Each r As Row In Tables("统计1").Rows
   If r.IsNull("分组列")=False Then
      Dim index As Integer=Array.indexof(nums2,r("分组列"))
      b.HGroups.AddDef(nums1(index),r("日期分组"),r("分组列"))\'添加列用于水平分组 
   End If
Next

For Each r As Row In Tables("统计2").Rows
  If r.IsNull("分组列")=False Then
    Dim index As Integer=Array.indexof(nums2,r("分组列"))
    If r.IsNull("日期分组")=False And  r.IsNull("模式")=False  Then
        b.VGroups.AddDef(nums1(index),r("日期分组"), r("模式"))
    ElseIf  r.IsNull("日期分组")=False And  r.IsNull("模式")=True  Then 
        b.VGroups.AddDef(nums1(index),r("日期分组"))
    ElseIf  r.IsNull("日期分组")=True And  r.IsNull("模式")=False  Then 
        b.VGroups.AddDef(nums1(index),r("模式"))
    Else
        b.VGroups.AddDef(nums1(index))   \'添加列用于垂直分组
    End If
 End If
Next

For Each r As Row In Tables("统计3").Rows
  If r.IsNull("统计列")=False Then
      Dim index As Integer=Array.indexof(nums2,r("统计列"))
      b.Totals.AddDef(nums1(index), AggregateEnum.Count) \'添加列用于统计
  End If
Next

If e.Form.Controls("CheckBox1").Checked = True Then   \'水平方向生成汇总
    b.HorizontalTotal = True
End If

If e.Form.Controls("CheckBox2").Checked = True Then   \'垂直方向生成汇总
    b.VerticalTotal = True
End If
b.Build \'生成统计表

 

 

 


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

 

 

老师,我的确定按钮的代码如上,

 

输入内容如图,

但是报错,请老师帮忙看一下


--  作者:有点甜
--  发布时间:2018/8/10 16:57:00
--  

要继续判断

 

If r("日期分组") = "年" Then

    b.VGroups.AddDef(nums1(index), DateGroup.Year, r("模式"))

ElseIf r("日期分组") = "月" Then 

    b.VGroups.AddDef(nums1(index), DateGroup.Month, r("模式"))

End If