以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]交叉统计设置 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=92743) |
||||
-- 作者:ajie5211 -- 发布时间:2016/11/11 15:22:00 -- [求助]交叉统计设置 交叉统计默认出来是这样的 如何转换成这样的? |
||||
-- 作者:有点蓝 -- 发布时间:2016/11/11 15:26:00 -- 上例子测试 |
||||
-- 作者:ajie5211 -- 发布时间:2016/11/11 15:41:00 --
希望达到效果 |
||||
-- 作者:有点色 -- 发布时间:2016/11/11 18:22:00 -- 参考代码
Dim dt As DataTable = DataTables("表A")
|
||||
-- 作者:y2287958 -- 发布时间:2016/11/12 12:44:00 -- 我更喜欢这么搞 Dim bm As String = "统计" Dim jb1 As New SQLJoinTableBuilder(bm,"表A") jb1.AddCols("年","周","组别","\'人数\' As 分类","人数 as aa") Dim jb2 As New SQLJoinTableBuilder(bm,"表A") jb2.AddCols("年","周","组别","\'产能\' As 分类","产能 as aa") Dim jb3 As New SQLJoinTableBuilder(bm,"表A") jb3.AddCols("年","周","组别","\'排单量\' As 分类","排单量 as aa") jb1.Union(jb2) jb1.Union(jb3) jb1.Build() Dim b As New CrossTableBuilder(bm,jb1.BuildSql ) b.HGroups.AddDef("年") b.HGroups.AddDef("周") b.HGroups.AddDef("分类") b.VGroups.AddDef("组别") b.Totals.AddDef("aa") b.Build Tables(bm).AutoSizeCols Tables(bm).MergeMode = MergeModeEnum.Standard Tables(bm).MergeCols.Clear() Tables(bm).MergeCols.Add("年") Tables(bm).MergeCols.Add("周") Tables(bm).MergeSort = "年,周" Tables(bm).AllowMerge = True MainTable = Tables(bm) |