以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 临时表数据无法使用 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=138350) |
||||
-- 作者:ifox2018 -- 发布时间:2019/7/29 15:11:00 -- 临时表数据无法使用 代码如下: Dim g As New GroupTableBuilder("sglsb", DataTables("car_accident")) g.Groups.AddDef("sg_rq", DateGroupEnum.Year, "year") g.Groups.AddDef("sg_rq",DateGroupEnum.Month, "month") g.Totals.AddDef("sg_rq",AggregateEnum.Count, "num") g.SamePeriodGrowth = True g.CircleGrowth = True g.Build() 生成的结果如图 无法将这个临时表同内环比数据读取出来。 使用的代码是 Dim sgr As Row = Tables("sglsb").current msgbox (sgr("环比增长")) msgbox (sgr("CircleGrowth")) 2个msgbox提示报错: 列“xxxx”不属于表 sglsb。 |
||||
-- 作者:有点蓝 -- 发布时间:2019/7/29 15:18:00 -- 环比增长应该是标题,统计表生成的列名不一定是这个。打开表结构查看真正的列名 |
||||
-- 作者:ifox2018 -- 发布时间:2019/7/29 21:33:00 -- Dim y As Integer = Date.Today.Year Dim m As Integer = Date.Today.Month Dim dt1 As New Date(y, m, 1) Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) \'获取本月的最后一天 Dim sglsg As New GroupTableBuilder("sglsb", DataTables("car_accident")) sglsg.Groups.AddDef("sg_rq", DateGroupEnum.Year, "year") sglsg.Groups.AddDef("sg_rq",DateGroupEnum.Month, "month") sglsg.Totals.AddDef("sg_rq",AggregateEnum.Count, "num") sglsg.SamePeriodGrowth = True sglsg.CircleGrowth = True sglsg.Build()\'\' Dim dr As Row dr = Tables("sglsb").Find("year = y and month = m ") If dr IsNot Nothing Then \'如果找到的话 msgbox(dr(numcle)) End If 黄色字体语句哪里不正确? 语句是想执行,搜索本月的记录, |
||||
-- 作者:有点蓝 -- 发布时间:2019/7/29 21:47:00 -- dr = DataTables("sglsb").Find("year = " & y & " and month = " & m ) [此贴子已经被作者于2019/7/30 10:34:03编辑过]
|
||||
-- 作者:ifox2018 -- 发布时间:2019/7/30 8:47:00 -- 和我的写法报错一样. 我的y 和 m 定义的是int 写成 dr = Tables("sglsb").Find("year = & y and month = & m ") 和 dr = Tables("sglsb").Find(year = & y and month = & m ) 也是错误 |
||||
-- 作者:有点蓝 -- 发布时间:2019/7/30 9:13:00 -- 请认真看,4楼的用法不可能有问题。上传具体实例说明 |
||||
-- 作者:ifox2018 -- 发布时间:2019/7/30 10:04:00 --
|
||||
-- 作者:有点蓝 -- 发布时间:2019/7/30 10:34:00 -- 应该是DataTables("a").Find Dim dr As DataRow dr =DataTables("a").Find("year = " & y & " and month = " & m ) If dr IsNot Nothing Then \'如果找到的话 msgbox(dr("cle")) End If |
||||
-- 作者:ifox2018 -- 发布时间:2019/7/30 13:47:00 -- 已OK 概念问题。 生成的临时表也是DataTables
|
||||
-- 作者:ifox2018 -- 发布时间:2019/7/30 16:39:00 -- 示例七 Dim g As New GroupTableBuilder("统计表2", DataTables("订单")) g.Groups.AddDef("日期", DateGroupEnum.Year, "年") g.Groups.AddDef("日期", "月") g.Totals.AddDef("数量") g.SamePeriodGrowth = True g.CircleGrowth= True g.Build() 上述帮助里的例子, g.SamePeriodGrowth = True g.CircleGrowth= True 环比是不是默认和上行数据进行比较而不进行判断 如图 能否理解为,如果我不知道表内的月份是否有缺失,环比这个值最好使用代码编写,而不是例子中的语句直接生成 |