此主题相关图片如下:1.png
''定义数据两个统计1\2的数据字典,便于引用显示值
Dim dmp1 = Tables("统计1").cols("分组列").DataMap
Dim dmp2 = Tables("统计2").cols("分组列").DataMap
Dim b1 As New CrossTableBuilder("统计表1","person")
''设置水平分组
For Each r As Row In Tables("统计1").Rows
If r.IsNull("分组列")=False Then
If r.IsNull("日期分组")=False Then
b1.HGroups.AddDef(r("分组列"), DateGroupEnum.Year, r("标题") )
Else
b1.HGroups.AddDef(r("分组列"),r("标题") )'添加列用于水平分组
End If
Else
Continue For
End If
Next
''设置垂直分组 count判断的是为空的列
Dim count As Integer = 0
For Each r As Row In Tables("统计2").Rows
If r.IsNull("分组列")=False Then
count=count+1
End If
Next
''判断是否没有选择垂直分组列
If count = 0 OrElse count = Tables("统计2").Rows.Count Then
MessageBox.Show("请选择垂直分组列", "提示", MessageBoxButtons.ok, MessageBoxIcon.Information)
''使得按钮点完后,不要再是选定色
e.form.controls("Table2").Select
Return
End If
''如果只有一组垂直分组列,就给加模式
If count=1 Then
For Each r As Row In Tables("统计2").Rows
If r.IsNull("分组列") =False Then
r("模式") =dmp2( r("分组列")) & "_{0}" ''作赋值操作
b1.VGroups.AddDef(r("分组列"), r("模式"))
Exit For
End If
Next
Else
For Each r As Row In Tables("统计2").Rows
If r.IsNull("分组列")=False Then
If r.IsNull("模式")=False Then ''如果用户输入模式,则允许并赋值
b1.VGroups.AddDef( r("分组列"), r("模式"))
Else
b1.VGroups.AddDef(r("分组列")) '添加列用于垂直分组
End If
End If
Next
End If
'
''设置统计
''避免用户跳过几行开始输入的问题
For Each r As Row In Tables("统计2").Rows
If r.IsNull("分组列") =False Then
b1.Totals.AddDef(r("分组列"), AggregateEnum.Count) '添加列用于统计
Exit For
End If
Next
'''设置统计选项
b1.HorizontalTotal = True '水平方向生成汇总
b1.VerticalTotal = True '垂直方向生成汇总
老师 ,红色那里我如何写表呀,我是 基于这个窗口下面这个表进行统计,