以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  欲对表A和表B用筛选后用GroupTableBuilder方法进行统计,再用BuildDataSource中的Combine方法进行合并,但是运行报错,请指正。  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=128238)

--  作者:soap_lwb
--  发布时间:2018/12/1 21:27:00
--  欲对表A和表B用筛选后用GroupTableBuilder方法进行统计,再用BuildDataSource中的Combine方法进行合并,但是运行报错,请指正。
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 dt1 As fxDataSource
Dim a As New GroupTableBuilder("统计表1",DataTables("管网管理所抢修热线"))
a.filter = Tables("管网管理所抢修热线").Filter
a.Groups.AddDef("来电时间",DateGroupEnum.None)

a.Totals.AddDef("来电信息",AggregateEnum.Count,"接单数量_管网A单") \'对接单数量进行count
a.Totals.AddDef("是否解决",AggregateEnum.Count,"已处理数量_管网A单") \'对接单数量进行count
dt1 = a.BuildDataSource()

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


dt1.Combine("来电时间",dt2,"来电时间")
dt1.Show("统计表1")