以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于多表统计的案例,有附件 希解答 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=40984) |
-- 作者:owenlyx -- 发布时间:2013/10/8 18:00:00 -- 关于多表统计的案例,有附件 希解答 请各位大神们帮我看看,总抱错说已经有了重复项的键.. 附件如下 |
-- 作者:有点甜 -- 发布时间:2013/10/8 20:27:00 -- 修改了一下,你看看是不是你想要的统计。参考着改一下。 Dim ary1() As String = {"款号", "条码号", "颜色", "尺码"} Dim ary2() As String = {"款号", "条码号", "颜色", "尺码"} Dim g As New GroupTableBuilder("统计表1", DataTables("盘点表")) Dim dt1 As fxDataSource g.Groups.AddDef("款号") g.Groups.AddDef("条码号") g.Groups.AddDef("颜色") g.Groups.AddDef("尺码") g.Totals.AddDef("实盘数","入库_件数") dt1 = g.BuildDataSource() \'-------销售表 ------------(销售表) Dim h As New GroupTableBuilder("统计表2", DataTables("销售表")) Dim dt2 As fxdatasource h.Groups.AddDef("款号") h.Groups.AddDef("条码号") h.Groups.AddDef("颜色") h.Groups.AddDef("尺码") \'h.Groups.AddDef("销售日期","销售_销售日期") h.Totals.AddDef("件数","销售_件数") dt2 = h.BuildDataSource() dt1.Combine(ary1,dt2,ary2) Tables("汇总表 _Table1").DataSource = dt1 \'将统计结果绑定到Table |
-- 作者:owenlyx -- 发布时间:2013/10/8 21:45:00 -- 有点甜老师 用了您的代码了, 但是结果还是一样,出现了"已经添加具有相同键的项" 不知道为什么..
|
-- 作者:有点甜 -- 发布时间:2013/10/8 22:15:00 -- 参考来做一下,适当修改,不要等别人贴上全部代码。 留意红色地方,参考帮助 http://www.foxtable.com/help/topics/2392.htm Dim ary1() As String = {"款号", "条码号", "颜色", "尺码"} Dim ary2() As String = {"款号", "条码号", "颜色", "尺码"} Dim g As New GroupTableBuilder("统计表1", DataTables("盘点表")) Dim dt1 As fxDataSource g.Groups.AddDef("款号") g.Groups.AddDef("条码号") g.Groups.AddDef("颜色") g.Groups.AddDef("尺码") g.Totals.AddDef("实盘数","入库_件数") dt1 = g.BuildDataSource() \'-------销售表 ------------(销售表) Dim h As New GroupTableBuilder("统计表2", DataTables("销售表")) Dim dt2 As fxdatasource h.Groups.AddDef("款号") h.Groups.AddDef("条码号") h.Groups.AddDef("颜色") h.Groups.AddDef("尺码") \'h.Groups.AddDef("销售日期","销售_销售日期") h.Totals.AddDef("件数","销售_件数") dt2 = h.BuildDataSource() dt1.Combine(ary1,dt2,ary2) Tables("汇总表 _Table1").DataSource = dt1 \'将统计结果绑定到Table |
-- 作者:yan2006l -- 发布时间:2013/10/8 22:21:00 -- 可怜的孩子,大家帮帮他把,看他问了好几天了还没解决 |
-- 作者:有点甜 -- 发布时间:2013/10/8 22:34:00 -- 代码 Dim ary1() As String = {"款号", "条码号", "颜色", "尺码"} Dim ary2() As String = {"款号", "条码号", "颜色", "尺码"} Dim g As New GroupTableBuilder("统计表1", DataTables("盘点表")) Dim dt1 As fxDataSource g.Groups.AddDef("款号") g.Groups.AddDef("条码号") g.Groups.AddDef("颜色") g.Groups.AddDef("尺码") g.Totals.AddDef("实盘数","入库_件数") dt1 = g.BuildDataSource() \'-------销售表 ------------(销售表) Dim h As New GroupTableBuilder("统计表2", DataTables("销售表")) Dim dt2 As fxdatasource h.Groups.AddDef("款号") h.Groups.AddDef("条码号") h.Groups.AddDef("颜色") h.Groups.AddDef("尺码") \'h.Groups.AddDef("销售日期","销售_销售日期") h.Totals.AddDef("件数","销售_件数") dt2 = h.BuildDataSource() \'---------------调入----------(入库表) Dim j As New GroupTableBuilder("统计表3", DataTables("入库表")) Dim dt3 As fxdatasource j.groups.adddef("款号") j.Groups.AddDef("条码号") j.Groups.AddDef("尺码") j.Groups.AddDef("颜色") \'j.Groups.AddDef("入库日期","入库_入库日期") \'j.Groups.AddDef("入库渠道","入库_入库渠道") j.Totals.AddDef("件数","入库_件数") dt3 = j.BuildDataSource() \'--------------调出 ----------(出库表) Dim k As New GroupTableBuilder("统计表4", DataTables("出库表")) Dim dt4 As fxdatasource k.Groups.AddDef("款号") k.Groups.AddDef("条码号") k.Groups.AddDef("尺码") k.Groups.AddDef("颜色") \'k.Groups.AddDef("出库日期","出库_出库日期") \'k.Groups.AddDef("收货地点","出库_收货地点") k.Totals.AddDef("件数","出库_件数") dt4 =k.BuildDataSource() dt1.Combine(ary1,dt2,ary2) dt1.Combine(ary1,dt3,ary2) dt1.Combine(ary1,dt4,ary2) Tables("汇总表 _Table1").DataSource = dt1 \'将统计结果绑定到Table |