以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 增加统计条件 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=136327) |
-- 作者:lfz123 -- 发布时间:2019/6/11 14:51:00 -- 增加统计条件 Dim filter As String = "供应商简称 is not null" Dim bd1 As New SQLGroupTableBuilder("统计表1","供应商") bd1.Filter = filter bd1.C Dim dt1 As fxDataSource bd1.Groups.AddDef("供应商简称") bd1.Totals.AddDef("期初余额") dt1 = bd1.BuildDataSource() Dim bd2 As New SQLGroupTableBuilder("统计表2","入库单") bd2.C Dim dt2 As fxDataSource bd2.Groups.AddDef("供应商简称") bd2.Totals.AddDef("含税金额","入库金额") bd2.Totals.AddExp("已对账金额","iif(申请单号 is null, 0, 含税金额)") bd2.Totals.AddEXP("未对账金额","iif(申请单号 is null, 含税金额, 0)") dt2 = bd2.BuildDataSource() Dim bd3 As New SQLGroupTableBuilder("统计表3","流水账") bd3.C Dim dt3 As fxDataSource bd3.Groups.AddDef("科目") 我想在这段代码加一个统计条件,科目= bd1里面的供应商简称才增加分组项,并不是所有的科目都会参与统计 bd3.Totals.AddDef("支出","付款金额") dt3 = bd3.BuildDataSource() dt1.Combine("供应商简称",dt2,"供应商简称") dt1.Combine("供应商简称",dt3,"科目") Tables("供应商列表_Table7").DataSource = dt1
|
-- 作者:有点蓝 -- 发布时间:2019/6/11 20:19:00 -- 试试 bd3.filter = "科目 in (select 供应商简称 in 供应商 where 供应商简称 is not null)"
|
-- 作者:lfz123 -- 发布时间:2019/6/12 10:26:00 -- 回复:(有点蓝)试试bd3.filter = "科目 in (select&... 错误提示: Dim bd3 As New SQLGroupTableBuilder("统计表3","流水账") bd3.filter = "科目 in (select 供应商简称 in 供应商 where 供应商简称 is not null)" bd3.C Dim dt3 As fxDataSource bd3.Groups.AddDef("科目") bd3.Totals.AddDef("支出","付款金额") dt3 = bd3.BuildDataSource() [此贴子已经被作者于2019/6/12 10:26:55编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/6/12 11:43:00 --
bd3.filter = "科目 in (select 供应商简称 from {供应商} where 供应商简称 is not null)" |