以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 没有满足统计条件的数据为什么统计结果不为空? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=139247) |
-- 作者:foxyuan -- 发布时间:2019/8/8 20:19:00 -- 没有满足统计条件的数据为什么统计结果不为空? 请教大神,下面的一个统计表,除了第一个合同台账里合同金额统计正确,为什么后面的几个表里明明没有“统计”列是选中的还都能统计出数据来?我哪里设置错误了?或问题一般会出在哪里? Dim bd1 As New SQLGroupTableBuilder("统计项目综合数据","合同台账") Dim dt1 As fxDataSource bd1.Groups.AddDef("项目编号") \'根据型号分组 bd1.Groups.AddDef("项目名称") \'根据型号分组 bd1.Totals.AddDef("合同金额","合同金额(元)") \'对数量进行合同统计 bd1.Filter = "统计 =true" bd1.Subtotal = True \'生成汇总模式 \'bd1.Subtotallevel = 0 \'只生成总计行 dt1 = bd1.BuildDataSource() Dim bd2 As New SQLGroupTableBuilder("统计表2","结算表") Dim dt2 As fxDataSource bd2.Groups.AddDef("项目编号") \'根据型号分组 bd2.Groups.AddDef("项目名称") \'根据型号分组 bd2.Totals.AddExp("最终结算金额","iif(批准金额 is null, 0, 批准金额) - iif(业主扣款金额 is null, 0, 业主扣款金额) - iif(总包扣款金额 is null, 0, 总包扣款金额) - iif(其他扣款金额 is null, 0, 其他扣款金额)","结算金额(元)")\'对数量进行统计 bd2.Filter = "统计 =true" bd2.Subtotal = True \'生成汇总模式 \'bd2.Subtotallevel = 0 \'只生成总计行 dt2 = bd2.BuildDataSource() Dim bd3 As New SQLGroupTableBuilder("统计表3","项目收款") Dim dt3 As fxDataSource bd3.Groups.AddDef("项目编号") \'根据型号分组 bd3.Groups.AddDef("项目名称") \'根据型号分组 bd3.Totals.AddDef("收款金额","回款金额(元)") \'对数量进行统计 bd3.Filter = "统计 =true" bd3.Subtotal = True \'生成汇总模式 \'bd3.Subtotallevel = 0 \'只生成总计行 dt3 = bd3.BuildDataSource() Dim bd4 As New SQLGroupTableBuilder("统计表4","项目付款") Dim dt4 As fxDataSource bd4.Groups.AddDef("项目编号") \'根据型号分组 bd4.Groups.AddDef("项目名称") \'根据型号分组 bd4.Totals.AddDef("付款金额","付款金额(元)") \'对数量进行统计 bd4.Filter = "统计 =true" bd4.Subtotal = True \'生成汇总模式 \'bd4.Subtotallevel = 0 \'只生成总计行 dt4 = bd4.BuildDataSource() Dim bd5 As New SQLGroupTableBuilder("统计表5","开发票") Dim dt5 As fxDataSource bd5.Groups.AddDef("项目编号") \'根据型号分组 bd5.Groups.AddDef("项目名称") \'根据型号分组 bd5.Totals.AddDef("{开发票}.开票金额","开发票金额(元)") \'对数量进行统计 bd5.Filter = "统计 =true" bd5.Subtotal = True \'生成汇总模式 \'bd5.Subtotallevel = 0 \'只生成总计行 dt5 = bd5.BuildDataSource() Dim bd6 As New SQLGroupTableBuilder("统计表6","收发票") Dim dt6 As fxDataSource bd6.Groups.AddDef("项目编号") \'根据型号分组 bd6.Groups.AddDef("项目名称") \'根据型号分组 bd6.Totals.AddDef("{收发票}.开票金额","收发票金额(元)") \'对数量进行统计 bd6.Filter = "统计 =true" bd6.Subtotal = True \'生成汇总模式 \'bd6.Subtotallevel = 0 \'只生成总计行 dt6 = bd6.BuildDataSource() Dim nms As String() = {"项目编号","项目名称"} \'指定连接列 dt1.Combine(nms,dt2,nms) \'将销售统计数据组合到进货统计数据 dt1.Combine(nms,dt5,nms) \' dt1.Combine(nms,dt3,nms) \' dt1.Combine(nms,dt4,nms) \' dt1.Combine(nms,dt6,nms) \'bd6.Subtotallevel = 0 \'只生成总计行\' dt1.Show("统计项目综合数据") \'显示统计结果 Tables("统计项目综合数据").DataSource = dt1 Dim t As Table = Tables("统计项目综合数据") Dim g As Subtotalgroup t.SubtotalGroups.Clear() t.GroupAboveData = False t.TreeVisible = False t.SpillNode = True g = New Subtotalgroup g.Aggregate = AggregateEnum.Sum g.GroupOn = "*" g.TotalOn = "合同金额(元),最终结算金额,开发票金额(元),回款金额(元),付款金额(元),收发票金额(元)" g.Caption = "总计" t.SubtotalGroups.Add(g) t.Subtotal() MainTable = Tables("统计项目综合数据")
|
-- 作者:有点蓝 -- 发布时间:2019/8/9 9:19:00 -- SQLGroupTableBuilder是后台统计,会统计整个表,而不仅仅是已经加载的数据 |
-- 作者:foxyuan -- 发布时间:2019/8/9 14:24:00 -- 谢谢。退出程序重启就正常了。 |