以文本方式查看主题
- Foxtable(狐表) (http://foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2)
---- 提示找不到某列,怎么解决啊 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=114968)
|
-- 作者:李孝春
-- 发布时间:2018/2/27 1:24:00
-- 提示找不到某列,怎么解决啊
提示找不到某列,怎么解决啊
下面红色部分代码 运行提示找不到年列
在卷宗入库中,有一个录入时间字段,是想根据录入时间字段值来判断年如果等于 &year 或者月等于& Month 结果我怎么改都没有改成功?求解啊
\'首先生成统计表 Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("卷宗入库")) b.Groups.AddDef("录入时间",DateGroupEnum.Year,"年") b.Groups.AddDef("录入时间",DateGroupEnum.Month,"月") b.Groups.AddDef("承办人") b.Totals.AddDef("承办人",AggregateEnum.Count,"卷宗编号") \'根据客户列来统计记录数,也就是卷宗编号 dt = b.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "年|月|承办人") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim Product As String = nd.DataRow("承办人") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(卷宗编号)","年 = " & Year) & "卷" & DataTables("卷宗入库").Compute("Sum(卷宗册数)","年= " & Year) & "册)" Case 1 nd.Text = nd.text & "月(" & dt.Compute("Sum(卷宗编号)","年 = " & Year & " And 月 = " & Month) & "卷" & DataTables("卷宗入库").Compute("Sum(卷宗册数)","年 = " & Year & " And 月 = " & Month) & "册)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & DataTables("卷宗入库").Compute("Sum(卷宗册数)") & "册)" End Select Next trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(卷宗编号)") & "卷" & DataTables("卷宗入库").Compute("Sum(卷宗册数)") & "册)",0) trv.ResumeRedraw
|
-- 作者:黄训良
-- 发布时间:2018/2/27 1:55:00
--
看看倒数第二个括号吧!
|
-- 作者:有点甜
-- 发布时间:2018/2/27 9:18:00
--
你应该先统计,然后,再在统计表里面查询统计的啊
Dim b As New GroupTableBuilder("统计表1",DataTables("卷宗入库")) b.Groups.AddDef("录入时间",DateGroupEnum.Year,"年") b.Groups.AddDef("录入时间",DateGroupEnum.Month,"月") b.Groups.AddDef("承办人") b.Totals.AddDef("承办人",AggregateEnum.Count,"卷宗编号") \'根据客户列来统计记录数,也就是卷宗编号
b.Totals.AddDef("承办人",AggregateEnum.sum,"卷宗册数")
\'.............
Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(卷宗编号)","年 = " & Year) & "卷" & dt.Compute("Sum(卷宗册数)","年= " & Year) & "册)"
|
-- 作者:李孝春
-- 发布时间:2018/2/27 10:36:00
-- 回复:(有点甜)你应该先统计,然后,再在统计表里面...
提示错误如下:
.NET Framework 版本:2.0.50727.8762 Foxtable 版本:2017.6.12.1 错误所在事件: 详细错误信息: 从字符串“杨毅军”到类型“Decimal”的转换无效。
杨毅军这个值是承办人的值 也就是第三节点的值
代码已经修正为:
Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("卷宗入库")) b.Groups.AddDef("录入时间",DateGroupEnum.Year,"年") b.Groups.AddDef("录入时间",DateGroupEnum.Month,"月") b.Groups.AddDef("承办人") b.Totals.AddDef("承办人",AggregateEnum.Count,"卷宗编号") \'根据客户列来统计记录数,也就是卷宗编号 b.Totals.AddDef("承办人",AggregateEnum.sum,"卷宗册数") dt = b.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "年|月|承办人") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim Product As String = nd.DataRow("承办人") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(卷宗编号)","年 = " & Year) & "卷" & dt.Compute("Sum(卷宗册数)","年= " & Year) & "册)" Case 1 nd.Text = nd.text & "月(" & dt.Compute("Sum(卷宗编号)","年 = " & Year & " And 月 = " & Month) & "卷" & dt.Compute("Sum(卷宗册数)","年 = " & Year & " And 月 = " & Month) & "册)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & dt.Compute("Sum(卷宗册数)","年 = " & Year & " And 月 = " & Month & " and 承办人 = " & Product) & "册)" End Select Next trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(卷宗编号)") & "卷" &dt.Compute("Sum(卷宗册数)") & "册)",0) trv.ResumeRedraw
|
-- 作者:有点甜
-- 发布时间:2018/2/27 10:52:00
--
修改这里
Case 2 nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & dt.Compute("Sum(卷宗册数)","年 = " & Year & " And 月 = " & Month & " and 承办人 = \'" & Product & "\'") & "册)"
|
-- 作者:有点甜
-- 发布时间:2018/2/27 10:53:00
--
或者改成
Case 2 nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & nd.DataRow("卷宗册数") & "册)"
|
-- 作者:李孝春
-- 发布时间:2018/2/27 11:12:00
-- 回复:(有点甜)或者改成?Case 2?&nbs...
楼上两个方法都试过 结果还是一样 提示错误
在卷宗统计功能里面 点击打开统计窗口 然后点击测试按钮 代码在测试按钮里面 密码默认888
[此贴子已经被作者于2018/2/27 11:16:13编辑过]
|
-- 作者:有点甜
-- 发布时间:2018/2/27 11:27:00
--
Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("卷宗入库")) b.Groups.AddDef("录入时间",DateGroupEnum.Year,"年") b.Groups.AddDef("录入时间",DateGroupEnum.Month,"月") b.Groups.AddDef("承办人") b.Totals.AddDef("承办人",AggregateEnum.Count,"卷宗编号") \'根据客户列来统计记录数,也就是卷宗编号 b.Totals.AddDef("卷宗册数",AggregateEnum.sum,"卷宗册数") dt = b.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "年|月|承办人") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim Product As String = nd.DataRow("承办人") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(卷宗编号)","年 = " & Year) & "卷" & dt.Compute("Sum(卷宗册数)","年= " & Year) & "册)" Case 1 nd.Text = nd.text & "月(" & dt.Compute("Sum(卷宗编号)","年 = " & Year & " And 月 = " & Month) & "卷" & dt.Compute("Sum(卷宗册数)","年 = " & Year & " And 月 = " & Month) & "册)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & nd.DataRow("卷宗册数") & "册)" \' nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & dt.Compute("Sum(卷宗册数)","年 = " & Year & " And 月 = " & Month & " and 承办人 = \'" & Product & "\'") & "册)" End Select Next trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(卷宗编号)") & "卷" &dt.Compute("Sum(卷宗册数)") & "册)",0) trv.ResumeRedraw
|
-- 作者:李孝春
-- 发布时间:2018/2/27 15:28:00
-- 回复:(有点甜)Dim dt As DataTableDim b As New Gr...
谢谢
|