甜哥,统计政治面貌的年龄分布我做了一个临时表,数值分布不会,麻烦您了!
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 = False Then
MessageBox.Show("请定义统计年龄段,并把无用的数据删除,否则系统将无法统计运行","提示")
Return
Else
If r1.Checked Then
fsd.add(r1("年龄段"))
End If
End If
Next
If fsd.count> 0 Then
fsd.sort
Dim dtb As New DataTableBuilder("统计2")
dtb.AddDef("工作单位", Gettype(String))
dtb.AddDef("所在部门", Gettype(String))
dtb.AddDef("政治面貌", Gettype(String))
If fsd.count = 1 Then
dtb.AddDef(fsd(0) & "岁以下", Gettype(Integer))
dtb.AddDef(fsd(0) & "岁以上", Gettype(Integer))
ElseIf fsd.count >= 2 Then
dtb.AddDef(fsd(0) & "岁以下", Gettype(Integer))
For fs As Integer = 0 To fsd.count-2
dtb.AddDef(fsd(fs) & "岁-" & fsd(fs+1) & "岁", Gettype(Integer))
Next
dtb.AddDef(fsd(fsd.count-1) & "岁以上", Gettype(Integer))
End If
dtb.Build()
End If
Dim flt As String
Dim dt As DataTable =DataTables("人事档案基础信息")
Dim t1 As Table =Tables("统计2")
t1.StopRedraw
'统计编码
For Each dc As Col In t1.Cols
If dc.Index > 1 Then
For Each dr As Row In t1.Rows
flt = "工作单位 = '" & dr("工作单位") & "' and 所在部门 = '" & dr("所在部门") & "' And " & dic(dr("政治面貌"))
If dc.Index = 4 Then
flt+ = " < " & dc.name.split("岁")(0)
ElseIf dc.Index =Tables("统计2").Cols.count -1 Then
flt+ = " >= " & dc.name.split("岁")(0)
ElseIf dc.Index > 4
flt+ = " >= " & dc.name.split("岁")(0) & " And " & dic(dr("科目")) & " < " & dc.Name.split("-")(1).split("岁")(0)
Else
Continue For
End If
dr(dc.name) =dt.Compute("Count(姓名)",flt)
Next
End If
Next
t1.DataTable.SysStyles("EmptyArea").BackColor = Color.White
t1.ResumeRedraw
MainTable = t1
Tables("统计_Table3").DataSource = DataTables("统计2")