以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  删除列的值为O的列  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133243)

--  作者:zhuxinhui
--  发布时间:2019/4/10 14:36:00
--  删除列的值为O的列

删除列总和值为O的列

 

Dim g As New CrossTableBuilder("全年销售", DataTables("销售"))
g.HGroups.AddDef("客户全称")
g.VGroups.AddDef("会计年度")
g.Totals.AddDef("结算金额", "结算金额")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
MainTable = Tables("全年销售")
DataTables("全年销售").DeleteFor( " 合计 = 0 ")
DataTables("全年销售").DataCols.Delete( " 合计 = 0 ")


--  作者:有点甜
--  发布时间:2019/4/10 15:37:00
--  
Dim g As New CrossTableBuilder("全年销售", DataTables("销售"))
g.HGroups.AddDef("客户全称")
g.VGroups.AddDef("会计年度")
g.Totals.AddDef("结算金额", "结算金额")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
MainTable = Tables("全年销售")
DataTables("全年销售").DeleteFor( "合计 = 0 ")
Dim ls As new List(Of String)
For Each dc As DataCol In DataTables("全年销售").DataCols
    If dc.IsNumeric Then
        If DataTables("全年销售").Compute("sum(" & dc.name & ")") = 0 Then
            ls.add(dc.name)
        End If
    End If
Next
For Each s As String In ls
    DataTables("全年销售").DataCols.Delete(s)
   
Next

--  作者:zhuxinhui
--  发布时间:2019/4/10 18:45:00
--  

多谢

删除行简单,删除列复杂些