以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  按日统计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=143539)

--  作者:longyanlin
--  发布时间:2019/11/28 8:49:00
--  按日统计

以下代码是年/月/周 统计的

Dim b As New CrossTableBuilder("统计表6",DataTables("生产订单"))
b.HGroups.AddDef("产品名称")
b.HGroups.AddDef("订单数量")
b.HGroups.AddDef("生产交期",DateGroupEnum.none)

b.VGroups.AddDef("生产交期",DateGroupEnum.Year,"{0}年")
b.VGroups.AddDef("生产交期","{0}月")
b.VGroups.AddDef("生产交期",DateGroupEnum.week,"{0}周")
b.Totals.AddDef("订单数量")
b.OrderByTotal = True
b.VerticalTotal= True
b.HorizontalTotal = True
b.Build()

请问如何改成按  年/月/周/日    来统计,谢谢


--  作者:有点蓝
--  发布时间:2019/11/28 9:26:00
--  

http://www.foxtable.com/webhelp/topics/0678.htm


DateGroupEnum枚举的可选值:

 

None :     不分组
Year:      按年分组 
Quarter:   按季度分组
Month:     按月分组
Week:      按周分组
Day:       按天分组,月中的某一天。
Hour:      按小时分组
Minute:    按分钟分组 Second:    按秒分组


--  作者:longyanlin
--  发布时间:2019/11/28 9:47:00
--  
谢谢,可以了,另外请问如何将最后一行统计行放到最前面呀?因为行数太多,看数据要翻到最后行,太麻烦,或者是出现在某一个texbox里面也可以,谢谢蓝老师!
--  作者:有点蓝
--  发布时间:2019/11/28 10:10:00
--  
排序:http://www.foxtable.com/webhelp/topics/0451.htm


--  作者:longyanlin
--  发布时间:2019/11/28 10:46:00
--  

老师这个是按列排序,我是想把最后的合计行显示在最第一行,如下图:

 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20191128105436.jpg
图片点击可在新窗口打开查看

也就是说把第37行的合计行放到第1行,全部代码如下,请帮忙修改:


 

Dim b As New CrossTableBuilder("统计表6",DataTables("生产订单"))
b.HGroups.AddDef("产品名称")
b.HGroups.AddDef("订单数量")
b.HGroups.AddDef("生产交期",DateGroupEnum.none)
b.VGroups.AddDef("生产交期",DateGroupEnum.Year,"{0}年")
b.VGroups.AddDef("生产交期","{0}月")
b.VGroups.AddDef("生产交期",DateGroupEnum.week,"{0}周")
b.VGroups.AddDef("生产交期",DateGroupEnum.day,"{0}日")
b.Totals.AddDef("订单数量")
b.OrderByTotal = True
b.VerticalTotal= True
b.HorizontalTotal = True
b.Build()

Dim t As Table = e.form.controls("Table1").Table
t.datasource = b.BuildDataSource
t.DataTable.GlobalHandler.AfterEdit = True
t.AllowEdit = True
e.form.controls("Table1").Table.AutoSizeCols(3)
t.DefaultRowHeight = 31

[此贴子已经被作者于2019/11/28 10:55:56编辑过]

--  作者:有点蓝
--  发布时间:2019/11/28 11:11:00
--  
Dim t As Table = e.form.controls("Table1").Table
t.datasource = b.BuildDataSource
t.DataTable.GlobalHandler.AfterEdit = True
t.AllowEdit = True
t.AutoSizeCols(3)
t.DefaultRowHeight = 31
t.rows(t.rows.count - 1).Move(0)

--  作者:longyanlin
--  发布时间:2019/11/28 11:29:00
--  

代码引用后显示“此表不支持移动行”


--  作者:有点蓝
--  发布时间:2019/11/28 12:01:00
--  
Dim t As Table = e.form.controls("Table1").Table
t.datasource = b.BuildDataSource
t.DataTable.GlobalHandler.AfterEdit = True
t.DataTable.DataCols.Add("_sortkey", Gettype(Decimal))
t.AllowEdit = True
t.AutoSizeCols(3)
t.DefaultRowHeight = 31
t.rows(t.rows.count - 1).Move(0)

--  作者:longyanlin
--  发布时间:2019/11/28 12:18:00
--  

代码引用后没有任何变化,与5楼一样


--  作者:有点蓝
--  发布时间:2019/11/28 13:41:00
--  
Dim t As Table = e.form.controls("Table1").Table
t.datasource = b.BuildDataSource
t.StopRedraw
t.DataTable.GlobalHandler.AfterEdit = True
t.AllowEdit = True
t.AutoSizeCols(3)
t.DefaultRowHeight = 31

t.DataTable.DataCols.Add("_sortkey", Gettype(Decimal))
For Each r As Row In t.Rows
    r("_sortkey") = r.Index
Next
t.rows(t.rows.count - 1).Move(0)
t.Sort = "_sortkey"
t.DataTable.AcceptChanges
t.ResumeRedraw