以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- SQLGroupTableBuilder中AddExp的条件表达式 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=148616) |
|
-- 作者:lfz123 -- 发布时间:2020/4/11 10:15:00 -- SQLGroupTableBuilder中AddExp的条件表达式 老师,黄色条件部分应该怎么写啊,数据源是access,表达式里面的红色背景是新生成的统计列 Dim bd1 As New SQLGroupTableBuilder("统计表1","会计科目") bd1.C bd1.AddTable("会计科目","一级码","凭证明细","一级码") bd1.Groups.AddDef("{会计科目}.一级码") bd1.Groups.AddDef("科目名称") bd1.Groups.AddDef("方向") bd1.Groups.AddDef("期初余额") bd1.Totals.AddDef("借方金额","借方累计") bd1.Totals.AddDef("贷方金额","贷方累计") \'bd1.Totals.AddExp("期末余额","方向 = \'借\',IsNull([期初余额],0) + ISNULL([借方累计],0) - ISNULL([贷方累计],0),IsNull([期初余额],0) + ISNULL([贷方累计],0) - ISNULL([借方累计],0))") Tables("窗口1_table2").DataSource = bd1.BuildDataSource
[此贴子已经被作者于2020/4/11 10:25:54编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2020/4/11 10:26:00 -- bd1.Totals.AddExp("期末余额","IIF(方向 = \'借\',IsNull([期初余额],0) + ISNULL([借方累计],0) - ISNULL([贷方累计],0),IsNull([期初余额],0) + ISNULL([贷方累计],0) - ISNULL([借方累计],0))") |
|
-- 作者:lfz123 -- 发布时间:2020/4/11 10:36:00 -- 回复:(有点蓝)bd1.Totals.AddExp("期末余额","IIF(... 此主题相关图片如下:1.png |
|
-- 作者:有点蓝 -- 发布时间:2020/4/11 11:04:00 -- 如果是SqlServer,改为case when :http://www.foxtable.com/webhelp/topics/2960.htm |
|
-- 作者:lfz123 -- 发布时间:2020/4/11 12:10:00 -- 回复:(有点蓝)如果是SqlServer,改为case whe... 老师是access数据源喔 |
|
-- 作者:有点蓝 -- 发布时间:2020/4/11 13:43:00 -- Dim bd1 As New SQLGroupTableBuilder("统计表1","会计科目") bd1.C bd1.AddTable("会计科目","一级码","凭证明细","一级码") bd1.Groups.AddDef("{会计科目}.一级码") bd1.Groups.AddDef("科目名称") bd1.Groups.AddDef("方向") bd1.Groups.AddDef("期初余额") bd1.Totals.AddDef("借方金额","借方累计") bd1.Totals.AddDef("贷方金额","贷方累计") Tables("窗口1_table2").DataSource = bd1.BuildDataSource DataTables("窗口1_table2").DataCols.Add("期末余额",Gettype(Double),""IIF(方向 = \'借\',IsNull([期初余额],0) + ISNULL([借方累计],0) - ISNULL([贷方累计],0),IsNull([期初余额],0) + ISNULL([贷方累计],0) - ISNULL([借方累计],0))"")
|
|
-- 作者:lfz123 -- 发布时间:2020/4/11 14:26:00 --
|
|
-- 作者:有点蓝 -- 发布时间:2020/4/11 14:37:00 -- Dim bd1 As New SQLGroupTableBuilder("统计表1","会计科目") bd1.C bd1.AddTable("凭证明细","一级码","会计科目","一级码",JoinModeEnum.Right) bd1.Groups.AddDef("{会计科目}.一级码")
|
|
-- 作者:lfz123 -- 发布时间:2020/4/11 14:52:00 -- 回复:(有点蓝)Dim bd1 As New SQLGroupTableBuilde... 错误提示如下 此主题相关图片如下:1.png 完整代码如下: Dim cnt As WinForm.ComboBox = e.Form.Controls("ComboBox1") If cnt.Text > "" Then Dim d As Date = cdate(cnt.Text) Dim bd1 As New SQLGroupTableBuilder("统计表1","会计科目") bd1.C bd1.AddTable("凭证明细","一级码","会计科目","一级码",JoinModeEnum.Right) bd1.filter = "{凭证明细}.月份 <= " & d.month bd1.Groups.AddDef("{会计科目}.一级码") \' bd1.Groups.AddDef("科目名称") bd1.Groups.AddDef("方向") bd1.Groups.AddDef("期初余额") bd1.Totals.AddDef("借方金额","借方累计") bd1.Totals.AddDef("贷方金额","贷方累计") Tables("窗口1_table2").DataSource = bd1.BuildDataSource With DataTables("窗口1_table2").DataCols .Add("期末余额",Gettype(Double), "iif(方向 = \'借\',IsNull([期初余额],0) + ISNULL([借方累计],0) - ISNULL([贷方累计],0),IsNull([期初余额],0) + ISNULL([贷方累计],0) - ISNULL([借方累计],0))") End With End If |
|
-- 作者:有点蓝 -- 发布时间:2020/4/11 15:02:00 -- 改为JoinModeEnum.left试试 或者 bd1.AddTable("会计科目","一级码","凭证明细","一级码",JoinModeEnum.left)
|