以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  这个统计方法,必须只能统计第一列  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91763)

--  作者:blackzhu
--  发布时间:2016/10/18 15:47:00
--  这个统计方法,必须只能统计第一列
这个统计方法 只能将列放在第一个?
我测试了半天,放第一个就可以,放中间就不行?????????????????


Dim t As Table = Tables("订单")
Dim
g As SubtotalGroup
t.SubtotalGroups.Clear
()
t.GroupAboveData = False
t.TreeVisible = False
g = New
SubtotalGroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn =
"产品"
g.Caption =
"{0}"
t.SubtotalGroups.Add(g)
t.Subtotal()

Dim r As Row
For
i As Integer = 0 To t.Rows.Count(True) - 1
    r = t.Rows(i,True)
    If
r.IsGroup \'如果是分组行
        Dim
f As String = "产品 = \'" & r("产品") &
"\'"
       
Dim v As String = " 订单数:" & t.Compute("Count(日期)",f)
        v = v & " 订购数量:" & t.Compute("Sum(数量)",f)
        v = v & " 订购金额:" & t.Compute("Sum(金额)",f)
        r("产品") = "产品:" & r("产品") & v
    End
If
Next


--  作者:blackzhu
--  发布时间:2016/10/18 15:58:00
--  
 搞定了.
--  作者:有点蓝
--  发布时间:2016/10/18 16:04:00
--  
可以的,不过要注意取值的列,以Excel报表.table为例

Dim t As Table = Tables("订单")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "客户"
g.Caption = "{0}"
t.SubtotalGroups.Add(g)
t.Subtotal()
Dim r As Row
For i As Integer = 0 To t.Rows.Count(True) - 1
    r = t.Rows(i,True)
    If r.IsGroup \'如果是分组行
        Dim f As String = "客户 = \'" & r("产品") & "\'"
        Dim v As String = " 订单数:" & t.Compute("Count(日期)",f)
        v = v & " 订购数量:" & t.Compute("Sum(数量)",f)
        v = v & " 订购金额:" & t.Compute("Sum(金额)",f)
        r("产品") = "客户:" & r("产品") & v
    End If
Next