Foxtable(狐表)用户栏目专家坐堂 → 请教汇总模式


  共有2186人关注过本帖树形打印复制链接

主题:请教汇总模式

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/12 14:41:00 [显示全部帖子]

上传具体实例测试。说明你最后需要达到的效果。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/12 17:40:00 [显示全部帖子]

判断等级,处理,如

 

For i As Integer = 0 To t.Rows.Count(True) - 1
    r = t.Rows(i,True)
    If r.IsGroup '如果是分组行
        If r.Level = 0 Then
            Dim f As String = "所属公司 = '" & r("所属公司") & "'"
            Dim v As String = " 立项数量:" & t.Compute("Count(项目编号)",f)
            r("项目编号") = "" & r("项目编号") & v
        ElseIf r.level = 1 Then
           
        ElseIf r.level = 2 Then
           
        End If
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/12 18:49:00 [显示全部帖子]

Dim t As Table = Tables("表A")
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}月"
g.DateGroup = DateGroupEnum.Month
t.SubtotalGroups.Add(g)

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()

Dim r As Row
For i As Integer = 0 To t.Rows.Count(True) - 1
    r = t.Rows(i,True)
    If r.IsGroup '如果是分组行
       
        If r.Level = -1 Then
            Dim f As String = ""
            Dim v As String = " 总计:" & t.Compute("Count(立项编号)",f)
            r("立项编号") = v
        ElseIf r.level = 0 Then
            Dim f As String = "所属公司 = '" & r("所属公司") & "'"
            Dim v As String = " 立项数量:" & t.Compute("Count(立项编号)",f)
            r("立项编号") = v
        ElseIf r.level = 1 Then
            Dim sum As Double = 0
            For j As Integer = i+1 To t.Rows.count(True)-1
                If t.Rows(j,True).IsGroup Then
                    Exit For
                Else
                    sum += 1
                End If
            Next
            Dim v As String = " 立项数量:" & sum
            r("立项编号") = v
        End If
       
    End If
Next


 回到顶部