以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]SQLCrossTableBuilder错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=43253)

--  作者:ifastudy
--  发布时间:2013/12/3 11:06:00
--  [求助]SQLCrossTableBuilder错误
代码如下:
Dim b As New SQLCrossTableBuilder("补货表H","D_RepBillItem") 
b.C
b.AddTable("D_RepBillItem","RepBillCode","D_RepBill","RepBillCode") \'添加统计表
b.AddTable("D_RepBillItem","SKUCode","B_SKU","SKUCode") \'添加统计表

b.HGroups.AddDef("{D_RepBill}.PartyCode") 
b.HGroups.AddDef("RepBillMakeDate","补货日期","补货日期") 
b.HGroups.AddDef("ProductColorCode")"增加款色
b.HGroups.AddDef("InsideLengthCode")"增加内长

b.VGroups.AddDef("SizeCode","尺码_{0}") \'添加产品列用于垂直分组,并设置了Pattern参数

b.Totals.AddDef("RepBillQty") \'添加数量列用于统计
b.Build \'生成统计表
b.Filter="RepBillMakeDate > \'2013-12-01\' and {D_RepBill}.PartyCode = \'HNZ219\'"
MainTable = Tables("补货表H") \'打开生成的统计表

问题:
1. b.Filter="RepBillMakeDate > \'2013-12-01\' and {D_RepBill}.PartyCode = \'HNZ219\'" 没有起到过滤作用,得到的是所有数据
2. RepBillMakeDate在MSSQL中是日期数据,b.HGroups.AddDef("RepBillMakeDate","补货日期","补货日期") 得到的是1~12间的整数,正好是月份。可是我没有设置月份啊
[此贴子已经被作者于2013-12-3 11:06:07编辑过]

--  作者:狐狸爸爸
--  发布时间:2013/12/3 11:10:00
--  
1、说明所有数据符合条件
2、默认是按月份,注意帮助中的说明:
 
添加水平分组到HGroups的语法是: 
HGroups.AddDef(Name)
HGroups.AddDef(Name, NewName)
HGroups.AddDef(Name, NewName, NewCaption)
HGroups.AddDef(Name, DateGroup)
HGroups.AddDef(Name, DateGroup, NewName)
HGroups.AddDef(Name, DateGroup, NewName, NewCaption)
参数说明

Name: 字符型,指定分组列。
NewName: 字符型,用于给分组列指定一个新的名称,这个名称在统计表中显示。
NewCaption: 字符型,用于给分组列设置标题。
DateGroup: DateGroupEnum型枚举,如果分组列是日期列,可用此属性指定如何根据日期进行分组,默认按月分组。
DateGroupEnum枚举的可选值:
 
None : 不分组
Year: 按年分组
Quarter: 按季度分组
Month: 按月分组
Week: 按周分组
Day: 按天分组,月中的某一天。
Hour: 按小时分组
Minute: 按分钟分组 Second: 按秒分组
 
 
直接按日期分组:
 
b.HGroups.AddDef("日期列",DateGroupEnum.None)

--  作者:ifastudy
--  发布时间:2013/12/3 11:37:00
--  
解决了,谢谢。
问题1:
b.Build \'生成统计表
b.Filter="RepBillMakeDate > \'2013-12-01\' and {D_RepBill}.PartyCode = \'HNZ219\'"
这两行位置反了。

问题2:b.HGroups.AddDef("RepBillMakeDate",DateGroupEnum.None,"补货日期","补货日期")