以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  分别对两张表单(A,B)做了筛选处理,想用GroupTableBuilder生成的“统计表1”做为拼接合成一个表,下面的代码运行过后只显示了表B的统计结果,请指正一下  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=128201)

--  作者:soap_lwb
--  发布时间:2018/11/30 20:07:00
--  分别对两张表单(A,B)做了筛选处理,想用GroupTableBuilder生成的“统计表1”做为拼接合成一个表,下面的代码运行过后只显示了表B的统计结果,请指正一下
Dim Filter1 As String

With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter1 >"" Then
            Filter1 = Filter1 & " And "
        End If
        Filter1 = Filter1 & "来电时间 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter1 >"" Then
            Filter1 = Filter1 & " And "
        End If
        Filter1 = Filter1 & "来电时间 <= #" & .Value & "#"
    End If
End With

If Filter1 > "" Then
    Tables("管网管理所抢修热线").Filter = Filter1
End If

Dim Filter2 As String

With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter2 >"" Then
            Filter2 = Filter2 & " And "
        End If
        Filter2 = Filter2 & "来电时间 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter2 >"" Then
            Filter2 = Filter2 & " And "
        End If
        Filter2 = Filter2 & "来电时间 <= #" & .Value & "#"
    End If
End With

If Filter1 > "" Then
    Tables("用户管理水表热线").Filter = Filter2
End If




Dim a As New GroupTableBuilder("统计表1",DataTables("管网管理所抢修热线"))

a.filter = Tables("管网管理所抢修热线").Filter


a.Groups.AddDef("来电时间",DateGroupEnum.Year,"年") 

a.Groups.AddDef("来电时间","月")

a.Groups.AddDef("来电时间",DateGroupEnum.Day,"日")

a.Totals.AddDef("来电信息",AggregateEnum.Count,"接单数量_管网A单") \'对数量进行统计
a.Build \'生成统计表


Dim b As New GroupTableBuilder("统计表1",DataTables("用户管理水表热线"))

b.filter = Tables("用户管理水表热线").Filter

b.Groups.AddDef("来电时间",DateGroupEnum.Year,"年")

b.Groups.AddDef("来电时间","月")

b.Groups.AddDef("来电时间",DateGroupEnum.Day,"日")

b.Totals.AddDef("来电信息",AggregateEnum.Count,"接单数量_表务B单") \'对数量进行统计
b.Build \'生成统计表
MainTable = Tables("统计表1") \'打开生成的统计表


--  作者:有点蓝
--  发布时间:2018/11/30 20:35:00
--  
多表合并参考:http://www.foxtable.com/webhelp/scr/2305.htm

类似

Dim dt1 As fxDataSource
Dim a As New GroupTableBuilder("统计表1",DataTables("管网管理所抢修热线"))
a.filter = Tables("管网管理所抢修热线").Filter
a.Groups.AddDef("来电时间",DateGroupEnum.Year,"年") 
a.Groups.AddDef("来电时间","月")
a.Groups.AddDef("来电时间",DateGroupEnum.Day,"日")
a.Totals.AddDef("来电信息",AggregateEnum.Count,"接单数量_管网A单") \'对数量进行统计
dt1 = a.BuildDataSource()

Dim dt2  As fxDataSource
Dim b As New GroupTableBuilder("统计表2",DataTables("用户管理水表热线"))
b.filter = Tables("用户管理水表热线").Filter
b.Groups.AddDef("来电时间",DateGroupEnum.Year,"年")
b.Groups.AddDef("来电时间","月")
b.Groups.AddDef("来电时间",DateGroupEnum.Day,"日")
b.Totals.AddDef("来电信息",AggregateEnum.Count,"接单数量_表务B单") \'对数量进行统计
dt2 = b.BuildDataSource()

Dim cls() As String = {"年","月","日"}
dt1.Combine(cls,dt2,cls)
dt1.Show("统计表1")