以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 如何组合多个交叉统计结果表 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=186206) |
|
-- 作者:gudao123456 -- 发布时间:2023/4/12 23:24:00 -- 如何组合多个交叉统计结果表 使用说明列举了组合多个分组统计表结果,如果组合多个交叉统计表结果,能照搬该例子吗?好像不可以,有垂直分组和水平分组,想通过水平分组关联。如何处理,谢谢! [此贴子已经被作者于2023/4/12 23:59:00编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2023/4/13 8:39:00 -- 一样的用法,水平分组的个数一致即可 |
|
-- 作者:gudao123456 -- 发布时间:2023/4/13 18:14:00 -- 但是出现这样的错误: 统计错误,错误原因: IErrorlnfo.GetDescription因E FAIL(0x80004005)而失败。 单独的每个交叉统计表是正确的 代码如下: MainTable = Tables("xszxztb") Dim fil As String If User.IsRole("学校资助专干") Then fil="[gzxx]=\'" & user.group & "\' and " Else If User.IsRole("县区资助管理") Then fil="[县区]=\'" & user.group & "\'and " End If End If Dim fil1 As String =e.Form.Controls("ComboBox2").text If fil1="" Then msgbox("你必须选择需要统计的学期") Return End If Dim dr As DataRow dr=DataTables("项目标准表").find("[xq]=\'" & fil1 & "\'") Dim cssfgzbz As Integer=dr("cssfgzmxfbz") Dim ncsfgzbz As Integer=dr("ncsfgzmxfbz") Dim csfsfgzbz As Integer=dr("csfsfgzmxfbz") Dim ncfsfgzbz As Integer=dr("ncfsfgzmxfbz") Dim cssfgzzfbz As Integer=dr("cssfgzmzfbz") Dim ncsfgzzfbz As Integer=dr("ncsfgzmzfbz") Dim csfsfgzzfbz As Integer=dr("csfsfgzmzfbz") Dim ncfsfgzzfbz As Integer=dr("ncfsfgzmzfbz") Dim ydbz As Integer=dr("ydzxjbz") Dim edbz As Integer=dr("edzxjbz") Dim sdbz As Integer=dr("sdzxjbz") Dim g1 As New sqlCrossTableBuilder("统计表1", "xszxztb") Dim dt1 As fxDataSource g1.C g1.Caption =fil1 & "资助项目统计表" g1.HGroups.AddDef("gzxx","学校名称") g1.VGroups.AddDef("mxfxm") g1.Totals.AddDef("sfzhm", AggregateEnum.Count, "人数") g1.Totals.AddExp("免学费金额","(case when [xxsx]=\'城市示范高中 \' then " & cssfgzbz/2 & " when [xxsx]=\'农村示范高中\' then " & ncsfgzbz/2 & " when [xxsx]=\'城市非示范高中\' then " & csfsfgzbz/2 & " when [xxsx]=\'农村非示范高中\' then " & ncfsfgzbz/2 & " end)") g1.HorizontalTotal = True g1.VerticalTotal = True g1.FromServer = True g1.Filter =fil & "[xq]=\'" & fil1 & "\'and [mxfxm] is not null" g1.Build dt1 = g1.BuildDataSource() Dim g2 As New sqlCrossTableBuilder("统计表2", "xszxztb") Dim dt2 As fxDataSource g2.HGroups.AddDef("gzxx","学校名称") g2.VGroups.AddDef("mzfxm") g2.Totals.AddDef("sfzhm", AggregateEnum.Count, "人数") g2.Totals.AddExp("免杂费金额","(case when [xxsx]=\'城市示范高中 \' then " & cssfgzzfbz/2 & " when [xxsx]=\'农村示范高中\' then " & ncsfgzzfbz/2 & " when [xxsx]=\'城市非示范高中\' then " & csfsfgzzfbz/2 & " when [xxsx]=\'农村非示范高中\' then " & ncfsfgzzfbz/2 & " end)") g2.HorizontalTotal = True g2.VerticalTotal = True g2.FromServer = True g2.Filter =fil & "[xq]=\'" & fil1 & "\' and [mzfxm] is not null" g2.Build dt2 = g2.BuildDataSource() Dim g3 As New SQLCrossTableBuilder("统计表3", "xszxztb") Dim dt3 As fxDataSource g3.C g3.Caption =fil1 & "助学金统计表" g3.HGroups.AddDef("gzxx","学校名称") g3.VGroups.AddDef("zxjxm") g3.Totals.AddDef("sfzhm", AggregateEnum.Count, "人数") g3.Totals.AddExp("助学金额","(case when [zxjxm]=\'国家普通高中一等助学金\' then " & ydbz/2 & " when [zxjxm]=\'国家普通高中二等助学金\' then " & edbz/2 & " when [zxjxm]=\'国家普通高中三等助学金\' then " & sdbz/2 & " end)") g3.Filter =fil & "[xq]=\'" & fil1 & "\' And [zxjxm] Is not null " g3.HorizontalTotal = True g3.VerticalTotal = True g3.Decimals = 2 g3.FromServer = True g3.Build dt3 = g3.BuildDataSource() dt1.Combine("gzxx",dt2,"gzxx") \'将免杂费统计数据组合到免学费统计数据 dt1.Combine("gzxx",dt3,"gzxx") MainTable = Tables("统计表1") e.Form.close() |
|
-- 作者:有点蓝 -- 发布时间:2023/4/13 19:58:00 -- …… g1.Totals.AddExp("免学费金额","(case when [xxsx]=\'城市示范高中 \' then " & cssfgzbz/2 & " when [xxsx]=\'农村示范高中\' then " & ncsfgzbz/2 & " when [xxsx]=\'城市非示范高中\' then " & csfsfgzbz/2 & " when [xxsx]=\'农村非示范高中\' then " & ncfsfgzbz/2 & " end)") 去掉这句g1.HorizontalTotal = True 去掉这句g1.VerticalTotal = True 去掉这句g1.FromServer = True g1.Filter =fil & "[xq]=\'" & fil1 & "\'and [mxfxm] is not null" 去掉这句g1.Build dt1 = g1.BuildDataSource() 其它统计一样去掉这几句
|
|
-- 作者:gudao123456 -- 发布时间:2023/4/15 12:37:00 -- 还是一样的错误,如果把 SQLCrossTableBuilder 改为 CrossTableBuilder 后,
|
|
-- 作者:有点蓝 -- 发布时间:2023/4/15 14:08:00 -- 请上传实例测试 |