以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]关于重命名统计表的列名问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174162)

--  作者:km007
--  发布时间:2022/1/4 21:04:00
--  [求助]关于重命名统计表的列名问题
请问:以下多表组合后的统计表,我想将“合计”列 重命名为 其他名称,请问如何写代码?

Dim bd1 As New CrossTableBuilder("统计表1",DataTables("进货单"))
Dim dt1 As fxDataSource
bd1.HGroups.AddDef("品名") \'根据品名分组
bd1.VGroups.AddDef("型号") \'根据型号分组
bd1.Totals.AddDef("进货金额") \'对金额进行统计
bd1.HorizontalTotal = True
bd1.VerticalTotal = True
dt1 = bd1.BuildDataSource() 
\'--------------------------------------------------------------------------------------------------------------------------------------
Dim bd2 As New CrossTableBuilder("统计表2",DataTables("销售单"))
Dim dt2 As fxDataSource
bd2.HGroups.AddDef("品名") \'根据品名分组
bd2.VGroups.AddDef("型号") \'根据型号分组
bd2.Totals.AddDef("销售金额") \'对金额进行统计
bd2.HorizontalTotal = True
bd2.VerticalTotal = True
dt2 = bd2.BuildDataSource()
\'--------------------------------------------------------------------------------------------------------------------------------------
Dim bd3 As New CrossTableBuilder("统计表3",DataTables("退货单"))
Dim dt3 As fxDataSource
bd3.HGroups.AddDef("品名") \'根据品名分组
bd3.VGroups.AddDef("型号") \'根据型号分组
bd3.Totals.AddDef("退货金额") \'对金额进行统计
bd3.HorizontalTotal = True
bd3.VerticalTotal = True
dt3 = bd3.BuildDataSource()
\'--------------------------------------------------------------------------------------------------------------------------------------
Dim nms As String() = {"品名"} \'指定连接列
dt1.Combine(nms,dt2,nms) \'将销售统计数据组合到进货统计数据
dt1.Combine(nms,dt3,nms) \'将退货统计数据组合到进货统计数据
dt1.Show("统计表1") \'显示统计结果

--  作者:有点蓝
--  发布时间:2022/1/4 21:11:00
--  
只能改标题:http://www.foxtable.com/webhelp/topics/1275.htm

With DataTables("统计表1")
    .DataCols(
"合计").Caption = "某某标题"
    .BuildHeader()

End
 With