以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]表不属于此dataset (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=158787) |
-- 作者:lgj716330 -- 发布时间:2020/12/2 15:35:00 -- [求助]表不属于此dataset 点击查询按钮的时候,第一次基本是正常的,当再次点击的时候经常 会跳出这个错误,会是什么原因呢 |
-- 作者:有点蓝 -- 发布时间:2020/12/2 15:35:00 -- 按钮完整代码看看 |
-- 作者:lgj716330 -- 发布时间:2020/12/2 15:42:00 -- 好象是查询时间间隔太近,时间隔久点查不会有问题 摸清规律了,第一次点击是可以的,第二次点击标题就变成数字,第三次点击就是上图的错误,第四次点击又恢复正常,如此循环 以下是第二次点击的结果 代码太长
[此贴子已经被作者于2020/12/2 15:50:22编辑过]
|
-- 作者:lgj716330 -- 发布时间:2020/12/2 15:58:00 -- Dim bb As New GroupTableBuilder("统计表bb",DataTables("查询表1")) bb.Groups.AddDef("总公司") bb.Groups.AddDef("事业部") bb.Totals.AddDef("金额") If N2>N1 Then bb.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & ") or (年份=" & N2 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then bb.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If bb.Build Dim b As New CrossTableBuilder("统计表",DataTables("查询表1")) Dim dt As fxDataSource b.HGroups.AddDef("总公司") b.VGroups.AddDef("事业部","本期销售_{0}") b.Totals.AddDef("金额") b.VerticalTotal=True If N2>N1 Then b.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & ") or (年份=" & N2 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt = b.BuildDataSource() msgbox(1) Dim b2 As New CrossTableBuilder("统计表2",DataTables("查询表1")) Dim dt2 As fxDataSource b2.HGroups.AddDef("总公司") b2.HGroups.AddDef(HZ3) b2.VGroups.AddDef("事业部","本期费用_{0}") b2.Totals.AddDef("金额") b2.VerticalTotal=True If N2>N1 Then b2.Filter = "(" & filter2 & ") and " & HZ3 & " is not null and ((年份=" & N1 & " and 月份 >= " & Y1 & ") or (年份=" & N2 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b2.Filter = "(" & filter2 & ") and " & HZ3 & " is not null and ((年份=" & N1 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt2 = b2.BuildDataSource() msgbox(2) Dim b22 As New CrossTableBuilder("统计表22",DataTables("查询表1")) Dim dt22 As fxDataSource b22.HGroups.AddDef("总公司") b22.VGroups.AddDef("事业部","同期销售_{0}") b22.Totals.AddDef("金额") b22.VerticalTotal=True If N2>N1 Then b22.Filter = "((年份=" & N11 & " and 月份 >= " & Y1 & ") or (年份=" & N22 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b22.Filter = "((年份=" & N11 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt22 = b22.BuildDataSource() Dim b222 As New CrossTableBuilder("统计表222",DataTables("查询表1")) Dim dt222 As fxDataSource b222.HGroups.AddDef("总公司") b222.HGroups.AddDef(HZ3) b222.VGroups.AddDef("事业部","同期费用_{0}") b222.Totals.AddDef("金额") b222.VerticalTotal=True If N2>N1 Then b222.Filter = "(" & filter2 & ") and " & HZ3 & " is not null and ((年份=" & N11 & " and 月份 >= " & Y1 & ") or (年份=" & N22 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b222.Filter = "(" & filter2 & ") and " & HZ3 & " is not null and ((年份=" & N11 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt222 = b222.BuildDataSource() msgbox(3) Dim nms As String()={"总公司",HZ3} dt2.Combine(nms,dt222,nms) dt.Combine("总公司",dt22,"总公司") dt2.Combine("总公司",dt,"总公司") dt2.show("统计表2") msgbox(4) Dim t As Table = Tables("统计表2") Dim prds2 As List(of String) = DataTables("统计表bb").GetValues("事业部") For Each prd2 As String In prds2 DataTables("统计表2").dataCols.add("本期费用占比_" & prd2, Gettype(Double)) Next msgbox(5) Dim prds As List(of String()) = DataTables("统计表bb").GetValues("金额|事业部") For Each c1 As String() In prds \'t.DataTable.DataCols.Add(c1 & "_销售",Gettype(Double)) For Each c As Col In t.Cols If c.Caption = "本期销售_" & c1(1) t.DataTable.ReplaceFor(c.Name,c1(0)) Exit For End If Next Next 第三次点击的时候显示标颜色的这里出错 [此贴子已经被作者于2020/12/2 16:26:37编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/12/2 16:10:00 -- 放到记事本发上来 |
-- 作者:有点蓝 -- 发布时间:2020/12/2 16:13:00 -- 标题就变成数字肯定代码有问题的。比如tables有2行,却给第三方赋值,不存在第三行就会赋值给标题行了 |
-- 作者:lw0310 -- 发布时间:2020/12/2 17:57:00 -- 用活字格这个太辣鸡了 用活字格这个太辣鸡了 |
-- 作者:lgj716330 -- 发布时间:2020/12/2 18:06:00 -- 一步步试下来,如果不绑定到窗口table都没问题,只要一绑定Tables("店铺费用构成情况_Table1").DataSource = dt2 ,就会有问题 |
-- 作者:lgj716330 -- 发布时间:2020/12/2 18:20:00 -- 知道问题了 Tables("店铺费用构成情况_Table1").DataSource = DataTables("统计表2")
|
-- 作者:lgj716330 -- 发布时间:2020/12/4 16:56:00 -- Dim b As New CrossTableBuilder("统计表",DataTables("查询表1")) Dim dt As fxDataSource b.HGroups.AddDef("总公司") b.VGroups.AddDef("事业部","本期销售_{0}") b.Totals.AddDef("金额") If N2>N1 Then b.Filter = " ((年份=" & N1 & " and 月份 >= " & Y1 & ") or (年份=" & N2 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt = b.BuildDataSource() Dim b22 As New CrossTableBuilder("统计表22",DataTables("查询表1")) Dim dt22 As fxDataSource b22.HGroups.AddDef("总公司") b22.VGroups.AddDef("事业部","同期销售_{0}") b22.Totals.AddDef("金额") If N2>N1 Then b22.Filter = "((年份=" & N11 & " and 月份 >= " & Y1 & ") or (年份=" & N22 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b22.Filter = "((年份=" & N11 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt22 = b22.BuildDataSource() dt.Combine("总公司",dt22,"总公司") dt.show("统计表") Dim b2 As New CrossTableBuilder("统计表2",DataTables("查询表1")) Dim dt2 As fxDataSource b2.HGroups.AddDef("总公司") b2.HGroups.AddDef("二级科目") b2.HGroups.AddDef("科目别名","科目名称") b2.VGroups.AddDef("事业部","本期费用_{0}") b2.Totals.AddDef("金额") If N2>N1 Then b2.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & ") or (年份=" & N2 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b2.Filter = "((年份=" & N1 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt2 = b2.BuildDataSource() Dim b222 As New CrossTableBuilder("统计表222",DataTables("查询表1")) Dim dt222 As fxDataSource b222.HGroups.AddDef("总公司") b222.HGroups.AddDef("二级科目") b222.HGroups.AddDef("科目别名","科目名称") b222.VGroups.AddDef("事业部","同期费用_{0}") b222.Totals.AddDef("金额") If N2>N1 Then b222.Filter = "((年份=" & N11 & " and 月份 >= " & Y1 & ") or (年份=" & N22 & " and 月份 <= " & Y2 & "))" ElseIf N2=N1 Then b222.Filter = "((年份=" & N11 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & "))" End If dt222 = b222.BuildDataSource() Dim nms As String()={"总公司","二级科目","科目名称"} dt2.Combine(nms,dt222,nms) dt2.Combine("总公司",dt,"总公司") dt2.show("统计表2") 显示以下错误
[此贴子已经被作者于2020/12/4 16:56:22编辑过]
|