以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  汇总统计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=51143)

--  作者:散客
--  发布时间:2014/5/20 17:27:00
--  汇总统计

Dim t As Table = Tables("融资组合查询_table1")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = True
t.TreeVisible = True
t.SpillNode = True

g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "备案单位"
g.TotalOn = "还款金额_*"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)

g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = "*"
g.Caption = "总计"
t.SubtotalGroups.Add(g)

t.Subtotal()

 

 

 窗口中形成的统计表,列数不固定 ,如何对所有列实现分组统计 要的就是汇总模式的效果(有目录树,统计分组在上)

求教!


--  作者:Bin
--  发布时间:2014/5/20 17:30:00
--  
for each c as col in t.cols
   if c.name.StartsWith("还款金额_") then
        g.TotalOn =c.name
   end if
next

--  作者:散客
--  发布时间:2014/5/20 18:23:00
--  

Dim t As Table = Tables("融资组合查询_TABLE1")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = True
t.TreeVisible = True
t.SpillNode = True

g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "备案单位"
For Each c As Col In t.cols
   If c.name.StartsWith("还款金额_") Then
        g.TotalOn =c.name
   End If
Next

\'g.TotalOn = "还款金额_1,还款金额_2,还款金额_3,还款金额_4,还款金额_5,还款金额_6,还款金额_7,还款金额_8,还款金额_9,还款金额_10,还款金额_11,还款金额_12,合计"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)

g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
For Each c1 As Col In t.cols
   If c1.name.StartsWith("还款金额_") Then
        g.TotalOn =c1.name
   End If
Next
\'g.TotalOn = "还款金额_1,还款金额_2,还款金额_3,还款金额_4,还款金额_5,还款金额_6,还款金额_7,还款金额_8,还款金额_9,还款金额_10,还款金额_11,还款金额_12,合计"
g.Caption = "总计"
t.SubtotalGroups.Add(g)

t.Subtotal()

 

 

 

未报错,但结果不对


--  作者:有点甜
--  发布时间:2014/5/20 19:10:00
--  

 试试这样

 

Dim t As Table = Tables("融资组合查询_TABLE1")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = True
t.TreeVisible = True
t.SpillNode = True

g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "备案单位"
Dim TotalOn As String = ""
For Each c As Col In t.cols
   If c.name.StartsWith("还款金额_") Then
        totalOn &= c.name & ","
   End If
Next
g.TotalOn = TotalOn & "合计"

\'g.TotalOn = "还款金额_1,还款金额_2,还款金额_3,还款金额_4,还款金额_5,还款金额_6,还款金额_7,还款金额_8,还款金额_9,还款金额_10,还款金额_11,还款金额_12,合计"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)

g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
For Each c As Col In t.cols
   If c.name.StartsWith("还款金额_") Then
        totalOn &= c.name & ","
   End If
Next
g.TotalOn = TotalOn & "合计"

\'g.TotalOn = "还款金额_1,还款金额_2,还款金额_3,还款金额_4,还款金额_5,还款金额_6,还款金额_7,还款金额_8,还款金额_9,还款金额_10,还款金额_11,还款金额_12,合计"
g.Caption = "总计"
t.SubtotalGroups.Add(g)

t.Subtotal()


--  作者:散客
--  发布时间:2014/5/20 21:10:00
--  
结果对了 谢了