Dim b As New CrossTableBuilder("统计表",DataTables("统计表0"))
Dim dt
As fxDataSource
b.HGroups.AddDef("部门名称")
b.HGroups.AddDef("年份")
b.VGroups.AddDef("月份","{0}月销售")
b.Totals.AddDef("销售金额")
b.Filter= "(" & filter & ")"
dt = b.BuildDataSource()
Dim b1 As New SQLGroupTableBuilder("统计表1","目标分解表")
b1.C
Dim dt1
As fxDataSource
b1.Groups.AddDef("部门名称")
b1.Groups.AddDef("年份")
b1.Totals.AddDef("一月","1月目标") '对数量进行统计
b1.Totals.AddDef("二月","2月目标") '对数量进行统计
b1.Totals.AddDef("三月","3月目标") '对数量进行统计
b1.Totals.AddDef("四月","4月目标") '对数量进行统计
b1.Totals.AddDef("五月","5月目标") '对数量进行统计
b1.Totals.AddDef("六月","6月目标") '对数量进行统计
b1.Totals.AddDef("七月","7月目标") '对数量进行统计
b1.Totals.AddDef("八月","8月目标") '对数量进行统计
b1.Totals.AddDef("九月","9月目标") '对数量进行统计
b1.Totals.AddDef("十月","10月目标") '对数量进行统计
b1.Totals.AddDef("十一月","11月目标") '对数量进行统计
b1.Totals.AddDef("十二月","12月目标") '对数量进行统计
b1.Totals.AddDef("合计","年度总目标") '对数量进行统计
b1.Filter= "年份= " & N1 & " and (" &
filter & ")"
dt1 =
b1.BuildDataSource()
Dim nms11 As
String() = {"部门名称","年份"}
dt.Combine(nms11,dt1,nms11)
Tables("统计_Table1").DataSource
= dt
Dim dic As new Dictionary(of
String, String)
For Each c As Col In Tables("统计_Table1").cols
dic.add(c.Caption, c.name)
Next
If dic.ContainsKey("1月销售")
= False Then
DataTables("统计_Table1").dataCols.add("1月销售",
Gettype(Double))
dic.add("1月销售", "1月销售")
End If
If dic.ContainsKey("2月销售")
= False Then
DataTables("统计_Table1").dataCols.add("2月销售",
Gettype(Double))
dic.add("2月销售", "2月销售")
End If
If dic.ContainsKey("3月销售")
= False Then
DataTables("统计_Table1").dataCols.add("3月销售",
Gettype(Double))
dic.add("3月销售", "3月销售")
End If
If dic.ContainsKey("4月销售")
= False Then
DataTables("统计_Table1").dataCols.add("4月销售",
Gettype(Double))
dic.add("4月销售", "4月销售")
End If
If dic.ContainsKey("5月销售")
= False Then
DataTables("统计_Table1").dataCols.add("5月销售",
Gettype(Double))
dic.add("5月销售", "5月销售")
End If
If dic.ContainsKey("6月销售")
= False Then
DataTables("统计_Table1").dataCols.add("6月销售",
Gettype(Double))
dic.add("6月销售", "6月销售")
End If
If dic.ContainsKey("7月销售")
= False Then
DataTables("统计_Table1").dataCols.add("7月销售",
Gettype(Double))
dic.add("7月销售", "7月销售")
End If
If dic.ContainsKey("8月销售") = False
Then
DataTables("统计_Table1").dataCols.add("8月销售",
Gettype(Double))
dic.add("8月销售",
"8月销售")
End If
If dic.ContainsKey("9月销售") = False
Then
DataTables("统计_Table1").dataCols.add("9月销售",
Gettype(Double))
dic.add("9月销售",
"9月销售")
End If
If dic.ContainsKey("10月销售") = False
Then
DataTables("统计_Table1").dataCols.add("10月销售",
Gettype(Double))
dic.add("10月销售",
"10月销售")
End If
If dic.ContainsKey("11月销售") = False
Then
DataTables("统计_Table1").dataCols.add("11月销售",
Gettype(Double))
dic.add("11月销售",
"11月销售")
End If
If dic.ContainsKey("12月销售") = False
Then
DataTables("统计_Table1").dataCols.add("12月销售",
Gettype(Double))
dic.add("12月销售",
"12月销售")
End If
提示不存在“统计表1”中的各个统计列,但结果又能出来,Tables("统计_Table1").DataSource = dt 之后的代码取消又不会提示错误
此主题相关图片如下:qq图片20201120142004.png
