Foxtable(狐表)用户栏目专家坐堂 → 窗体中如何做选择交叉统计


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

主题:窗体中如何做选择交叉统计

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2019/4/21 17:42:00 [显示全部帖子]

参考

 

Dim n1 As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")
Dim n2 As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox2")
Dim filter As String = "1=1"
If n1.value <> Nothing Then
    filter &= " and 进入本单位时间 >= #" & new Date(n1.value, 1, 1) & "#"
End  If
If n2.value <> Nothing Then
    filter &= " and 进入本单位时间 < #" & new Date(n2.value+1, 1, 1) & "#"
End  If

Dim ck As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
Dim groupcols As new List(of String)
For i As Integer = 0 To ck.Items.count - 1 '获取已经勾选的列
    If ck.GetItemChecked(i) Then
        Select Case ck.Items(i)
            Case "按职务统计"
                groupcols.add("现任职务")
            Case "按级别统计"
                groupcols.add("级别")
            Case "按专业技术职务统计"
                groupcols.add("专业技术职务")
            Case "按学历统计"
                groupcols.add("学历")
            Case "按政治面貌务统计"
                groupcols.add("政治面貌")
        End Select
    End If
Next

Dim g As New CrossTableBuilder("统计表1", DataTables("人事档案基础信息"))
g.HGroups.AddDef("进入本单位时间", DateGroupEnum.Year, "加入本单位年度")
g.HGroups.AddDef("所在部门")
For Each c As String In groupcols
    g.HGroups.AddDef(c)
Next
g.VGroups.AddDef("性别")
g.Totals.AddDef("姓名", AggregateEnum.Count, "人数")
g.HorizontalTotal = True
g.VerticalTotal = True
g.filter = filter
Tables("统计_Table1").DataSource = g.BuildDataSource


 回到顶部