以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  删除符合的行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=50557)

--  作者:尽快
--  发布时间:2014/5/8 23:45:00
--  删除符合的行

Dim bd1 As New GroupTableBuilder("统计",DataTables("账户"))
Dim dt1 As fxDataSource
bd1.FromServer = True
bd1.Groups.AddDef("账户名称")
bd1.Totals.AddDef("初始金额")
dt1 = bd1.BuildDataSource()

Dim Products As List(Of String)
Products = DataTables("账户").GetValues("账户名称")
For Each Product As String In Products
    Output.Show(Product)
Next

 

Dim bd2 As New GroupTableBuilder("统计表2",DataTables("流水账"))
Dim dt2  As fxDataSource
bd2.Filter = "[类别] =\'支出\'"
bd2.FromServer = True
bd2.Groups.AddDef("账户名称")
bd2.Totals.AddDef("金额","支出金额")
dt2 = bd2.BuildDataSource()

Dim bd3 As New GroupTableBuilder("统计表3",DataTables("流水账"))
Dim dt3 As fxDataSource
bd3.Filter = "[类别] = \'收入\'"
bd3.FromServer = True
bd3.Groups.AddDef("账户名称")
bd3.Totals.AddDef("金额","收入金额")
dt3 = bd3.BuildDataSource()

dt1.Combine("账户名称",dt2,"账户名称")
dt1.Combine("账户名称",dt3,"账户名称")
dt1.Show("统计")
DataTables("统计").DataCols.Add("余额",Gettype(Double),"( IIF( 初始金额 Is null,0,初始金额) -IIF( 支出金额 Is null,0, 支出金额) + IIF(收入金额 Is Null,0,收入金额))")

 

Dim Products As List(Of String)
Products = DataTables("账户").GetValues("账户名称")

 

现在的问题是我需要把统计表里”账户名称“ 不是 DataTables("账户"). 里的账户名称的行删除掉

希望哪位高手给下代码

[此贴子已经被作者于2014-5-8 23:46:24编辑过]

--  作者:Bin
--  发布时间:2014/5/9 8:47:00
--  
dim zhmc as string =  DataTables("账户").GetComboListString("账户名称").replace("|","\',\'")



Dim bd2 As New GroupTableBuilder("统计表2",DataTables("流水账"))
Dim dt2  As fxDataSource
bd2.Filter = "[类别] =\'支出\' 
and 账户名称 in (\'" & zhmc  & "\')"
bd2.FromServer = True
bd2.Groups.AddDef("账户名称") 
bd2.Totals.AddDef("金额","支出金额") 
dt2 = bd2.BuildDataSource()

Dim bd3 As New GroupTableBuilder("统计表3",DataTables("流水账"))
Dim dt3 As fxDataSource
bd3.Filter = "[类别] = \'收入\' and 
账户名称 in (\'" & zhmc  & "\')"

bd3.FromServer = True
bd3.Groups.AddDef("账户名称") 
bd3.Totals.AddDef("金额","收入金额") 
dt3 = bd3.BuildDataSource()

dt1.Combine("账户名称",dt2,"账户名称") 
dt1.Combine("账户名称",dt3,"账户名称") 
dt1.Show("统计") 
DataTables("统计").DataCols.Add("余额",Gettype(Double),"( IIF( 初始金额 Is null,0,初始金额) -IIF( 支出金额 Is null,0, 支出金额) + IIF(收入金额 Is Null,0,收入金额))")