Dim dt As DataTable =DataTables("人事档案基础信息")
Dim t1 As Table =Tables("统计2")
t1.StopRedraw
'统计编码
For Each sr As String() In dt.GetValues("工作单位|所在部门|政治面貌")
Dim r2 As Row = t1.AddNew
r2("工作单位") = sr(0)
r2("所在部门") = sr(1)
r2("政治面貌") = sr(2)
Dim flt As String = "工作单位 = '" & sr(0) & "' and 所在部门 = '" & sr(1) & "' And 政治面貌 = '" & sr(2) & "'"
For Each dc As Col In t1.Cols
Dim filter As String = flt
If dc.Name.Contains("岁") Then
If dc.Name.Contains("岁以下") Then
filter &= " and 年龄 < " & dc.name.split("岁")(0)
ElseIf dc.Name.Contains("岁以上") Then
filter &= "and 年龄 >= " & dc.name.split("岁")(0)
Else
Dim arr() As String = dc.name.split("-")
filter &= "and 年龄 >= " & arr(0).split("岁")(0) & " And 年龄 < " & arr(1).split("岁")(0)
End If
r2(dc.name) =dt.Compute("Count(姓名)",filter )
End If
Next
Next