以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  使用SQLGroupTableBuilder方泽,在发布软件后,使用SQL数据库作为数据源,发布的应用软件出错,怎么办?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=128339)

--  作者:soap_lwb
--  发布时间:2018/12/4 13:09:00
--  使用SQLGroupTableBuilder方泽,在发布软件后,使用SQL数据库作为数据源,发布的应用软件出错,怎么办?

图片点击可在新窗口打开查看此主题相关图片如下:出错.png
图片点击可在新窗口打开查看

--  作者:soap_lwb
--  发布时间:2018/12/4 14:13:00
--  
要使用外部数据源,这个统计代码怎么改?

Dim Filter1 As String = "1=1"
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
 
Dim tjb As String = "热线统计表"
Dim d As fxDataSource

Dim bms As String = "管网管理所抢修热线|用户管理水表热线|咨询业务热线登记表|公司内部业务热线登记表"
Dim i As Integer = 0
For Each bm As String In bms.split("|")
    Dim b1 As New SQLGroupTableBuilder(tjb,bm)
              b1.C
    b1.Groups.AddExp("来电时间","来电时间")
    b1.Totals.AddExp(bm & "_接单量","1")
    b1.Totals.AddExp(bm & "_已处理数量","iif(是否解决=true,1,0)")
    b1.Totals.AddExp(bm & "_未处理数量","iif(是否解决=true,0,1)")
    b1.filter = filter1
    Dim d1 As fxDataSource = b1.BuildDataSource()
    If i = 0 Then
        d = d1
    Else
        d.Combine("来电时间",d1,"来电时间")
    End If
    i += 1
Next

d.Show(tjb)
MainTable = Tables(tjb) \'打开生成的统计表"

Dim t As Table = Tables(tjb)
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
Dim ls As new List(Of String)
For Each c As Col In t.Cols
    If c.IsNumeric Then
        ls.add(c.Name)
    End If
Next
g.TotalOn = String.join(",", ls.ToArray)
g.Caption = "合计"
t.SubtotalGroups.Add(g)
t.Subtotal()

--  作者:有点甜
--  发布时间:2018/12/4 14:29:00
--  

修改

 

    b1.Totals.AddExp(bm & "_已处理数量","iif(是否解决=true,1,0)")
    b1.Totals.AddExp(bm & "_未处理数量","iif(是否解决=true,0,1)")

 

改成

 

    b1.Totals.AddExp(bm & "_已处理数量","case when 是否解决=1 then 1 else 0 end")
    b1.Totals.AddExp(bm & "_未处理数量","case when 是否解决=1 then 0 else 1 end")
[此贴子已经被作者于2018/12/4 14:29:31编辑过]

--  作者:soap_lwb
--  发布时间:2018/12/4 16:06:00
--  不填日期,不会报错,在窗口填上日期就会报以下错误

图片点击可在新窗口打开查看此主题相关图片如下:报错003.png
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2018/12/4 16:11:00
--  

改成

 

Dim Filter1 As String = "1=1"
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