以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]公式不能自动计算出结果 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141143) |
-- 作者:紫色幽魂 -- 发布时间:2019/9/22 17:07:00 -- [求助]公式不能自动计算出结果 sz1是个数组,存的是列名,增加列的时候设置表达式,最后结果出来都是空白的,应该有数据才对,我试了几种都不行,请问蓝色部分应该怎么改 With DataTables("射线拍片_Table4") .DataCols.Add("纵向对接_计划量_条",Gettype(Integer),""& sz1(i5) &" + "& sz1(i6) &" + "& sz1(i7) &"","纵向对接(顶,底,腹)_计划量_条") .DataCols.Add("纵向对接_有效拍片量_条",Gettype(Integer), sz1(x5) &"+"& sz1(x6) &"+"& sz1(x7) ,"纵向对接(顶,底,腹)_有效拍片量_条") End With
|
-- 作者:有点蓝 -- 发布时间:2019/9/22 21:08:00 -- msgbox(sz1(i5) & " + " & sz1(i6) & " + " & sz1(i7)) ‘显示什么内容? |
-- 作者:紫色幽魂 -- 发布时间:2019/9/22 22:39:00 -- 回复:(有点蓝)msgbox(sz1(i5) & " + " & s... 此主题相关图片如下:tim截图20190922223548.png 最终的表可以生成,但是公式中需要将前面的列的数据加到一起这个位置不起作用,没有数据显示出来 Dim tb4 As Table = e.Form.Controls("Table4").Table \'生成前面分组列 Dim b1 As New SQLGroupTableBuilder("统计表1","无损_射线_拍片计划量") Dim zhb1 As fxDataSource b1.C b1.Groups.AddDef("工程名称") b1.Groups.AddDef("单项工程名称") b1.Groups.AddDef("检验批名称") b1.Groups.AddDef("检验批吨位") b1.Groups.AddDef("总段数") b1.Groups.AddDef("结构形式") b1.Groups.AddDef("板厚","板厚范围") zhb1 = b1.BuildDataSource() \'生成计划量 Dim b2 As New SQLCrossTableBuilder("统计表1","无损_射线_拍片计划量") Dim zhb2 As fxDataSource b2.C b2.HGroups.AddDef("工程名称") b2.HGroups.AddDef("单项工程名称") b2.HGroups.AddDef("检验批名称") b2.VGroups.AddDef("焊缝类型","计划量_{0}") b2.VGroups.AddDef("部位") b2.Totals .AddDef("计划量") zhb2 = b2.BuildDataSource() \'统计实际检测量(条) Dim b3 As New SQLCrossTableBuilder("统计表1","无损_检测明细") Dim zhb3 As fxDataSource b3.C b3.HGroups.AddDef("工程名称") b3.HGroups.AddDef("单项工程","单项工程名称") b3.HGroups.AddDef("检验批","检验批名称") b3.VGroups.AddDef("焊缝类型","有效拍片量条_{0}") b3.VGroups.AddDef("拍片_部位") b3.Totals.AddDef("检测量_单位1") b3.Filter = "焊缝类型 is not null and 拍片_部位 is not null" zhb3 = b3.BuildDataSource() \'统计实际检测量(张) Dim b4 As New SQLCrossTableBuilder("统计表1","无损_检测明细") Dim zhb4 As fxDataSource b4.C b4.HGroups.AddDef("工程名称") b4.HGroups.AddDef("单项工程","单项工程名称") b4.HGroups.AddDef("检验批","检验批名称") b4.VGroups.AddDef("焊缝类型","有效拍片量张_{0}") b4.VGroups.AddDef("拍片_部位") b4.Totals.AddDef("首检_检测长度") b4.Filter = "焊缝类型 is not null and 拍片_部位 is not null" zhb4 = b4.BuildDataSource() Dim sz As String() = {"工程名称","单项工程名称","检验批名称"} zhb1.Combine(sz,zhb2,sz) zhb1.Combine(sz,zhb3,sz) zhb1.Combine(sz,zhb4,sz) tb4.StopRedraw \'暂停绘制表单 tb4.DataSource = zhb1 \'没有对应的列增加列 \'有效排片量(张) Dim sz3() As String = {"有效拍片量条_横向对接_顶板","有效拍片量条_横向对接_底板","有效拍片量条_横向对接_腹板","有效拍片量条_横向对接_横隔板","有效拍片量条_纵向对接_顶板","有效拍片量条_纵向对接_底板","有效拍片量张_纵向对接_腹板","有效拍片量张_横向对接_顶板","有效拍片量张_横向对接_底板","有效拍片量张_横向对接_腹板","有效拍片量张_横向对接_横隔板","有效拍片量张_纵向对接_顶板","有效拍片量张_纵向对接_底板","有效拍片量张_纵向对接_腹板"} Dim jh3 As new List(of String) jh3.AddRange(sz3) For a As Integer = 0 To sz3.Length - 1 If DataTables("射线拍片_Table4").DataCols.Contains(sz3(a)) = False DataTables("射线拍片_Table4").DataCols.Add(sz3(a),Gettype(Integer),"",sz3(a)) End If Next \'列名和标题转换---------------------------------------------------------------------------------------------------------------------------------------------------------- Dim jh1,jh2 As new List(of String) Dim sz1(),sz2() As String Dim i1,i2,i3,i4,i5,i6,i7 As Integer Dim x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14 As Integer \'转换计划量 For Each dc As DataCol In DataTables("射线拍片_Table4") .DataCols jh1.Add(dc.Name) \'列名 jh2.Add(dc.Caption) \'标题 Next sz1 = jh1.ToArray sz2 = jh2.ToArray i1 = Array.IndexOf(sz2,"计划量_横向对接_顶板") i2 = Array.IndexOf(sz2,"计划量_横向对接_底板") i3 = Array.IndexOf(sz2,"计划量_横向对接_腹板") i4 = Array.IndexOf(sz2,"计划量_横向对接_横隔板") i5 = Array.IndexOf(sz2,"计划量_纵向对接_顶板") i6 = Array.IndexOf(sz2,"计划量_纵向对接_底板") i7 = Array.IndexOf(sz2,"计划量_纵向对接_腹板") \'转换拍片量 x1 = Array.IndexOf(sz2,"有效拍片量条_横向对接_顶板") x2 = Array.IndexOf(sz2,"有效拍片量条_横向对接_底板") x3 = Array.IndexOf(sz2,"有效拍片量条_横向对接_腹板") x4 = Array.IndexOf(sz2,"有效拍片量条_横向对接_横隔板") x5 = Array.IndexOf(sz2,"有效拍片量条_纵向对接_顶板") x6 = Array.IndexOf(sz2,"有效拍片量条_纵向对接_底板") x7 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_腹板") x8 = Array.IndexOf(sz2,"有效拍片量张_横向对接_顶板") x9 = Array.IndexOf(sz2,"有效拍片量张_横向对接_底板") x10 = Array.IndexOf(sz2,"有效拍片量张_横向对接_腹板") x11 = Array.IndexOf(sz2,"有效拍片量张_横向对接_横隔板") x12 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_顶板") x13 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_底板") x14 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_腹板") Dim t1 As String = sz1(x5) &"+"& sz1(x6) &"+"& sz1(x7) \'合并各列数值 With DataTables("射线拍片_Table4") msgbox(sz1(i5) & " + " & sz1(i6) & " + " & sz1(i7)) .DataCols.Add("纵向对接_计划量_条",Gettype(Integer), sz1(i5) & " + " & sz1(i6) & " + " & sz1(i7),"纵向对接(顶,底,腹)_计划量_条") \'.DataCols.Add("纵向对接_计划量_条",Gettype(Integer),""& sz1(i5) &" + "& sz1(i6) &" + "& sz1(i7) &"","纵向对接(顶,底,腹)_计划量_条") .DataCols.Add("纵向对接_有效拍片量_条",Gettype(Integer), sz1(x5) &"+"& sz1(x6) &"+"& sz1(x7) ,"纵向对接(顶,底,腹)_有效拍片量_条") \'.DataCols.Add("纵向对接_有效拍片量_条",Gettype(Integer),""& sz1(x5) &" + "& sz1(x6) &" + "& sz1(x7) &"","纵向对接(顶,底,腹)_有效拍片量_条") .DataCols.Add("纵向对接_有效拍片量_张",Gettype(Integer),""& sz1(x12) &" + "& sz1(x13) &" + "& sz1(x14) &"","纵向对接(顶,底,腹)_有效拍片量_张") .DataCols.Add("横向对接_计划量_条",Gettype(Integer),""& sz1(i1) &" + "& sz1(i2) &" + "& sz1(i3) &"","横向对接(顶,底,腹)_计划量_条") .DataCols.Add("横向对接_有效拍片量_条",Gettype(Integer),""& sz1(x1) &" + "& sz1(x2) &" + "& sz1(x3) &"","横向对接(顶,底,腹)_有效拍片量_条") .DataCols.Add("横向对接_有效拍片量_张",Gettype(Integer),""& sz1(x8) &" + "& sz1(x9) &" + "& sz1(x10) &"","横向对接(顶,底,腹)_有效拍片量_张") .DataCols.Add("横隔板横向对接_计划量_条",Gettype(Integer),""& sz1(i4) &"") .DataCols.Add("横隔板横向对接_有效拍片量_条",Gettype(Integer),""& sz1(x4) &"") .DataCols.Add("横隔板横向对接_有效拍片量_张",Gettype(Integer),""& sz1(x11) &"") .DataCols.Add("拍片量统计_计划_总条数",Gettype(Integer),"纵向对接_计划量_条 + 横向对接_计划量_条 + 横隔板横向对接_计划量_条") .DataCols.Add("拍片量统计_有效拍片量统计_条数",Gettype(Integer),"纵向对接_有效拍片量_条 + 横向对接_有效拍片量_条 + 横隔板横向对接_有效拍片量_条") .DataCols.Add("拍片量统计_有效拍片量统计_张数",Gettype(Integer),"纵向对接_有效拍片量_张 + 横向对接_有效拍片量_张 + 横隔板横向对接_有效拍片量_张") .DataCols.Add("拍片量统计_不合格拍片量统计_条数",Gettype(Integer),"") .DataCols.Add("拍片量统计_不合格拍片量统计_张数",Gettype(Integer),"") .DataCols.Add("拍片量统计_差额_条数",Gettype(Integer),"拍片量统计_计划_总条数 - 拍片量统计_有效拍片量统计_条数") .DataCols.Add("拍片量统计_合格率(张)",Gettype(Integer),"") End With \'设置列可见 Dim sz4() As String = {"工程名称","单项工程名称","检验批名称","检验批吨位","结构形式","板厚","总段数","结构形式","板厚范围","纵向对接(顶,底,腹)_计划量_条","纵向对接(顶,底,腹)_有效拍片量_条","纵向对接(顶,底,腹)_有效拍片量_张","横向对接(顶,底,腹)_计划量_条","横向对接(顶,底,腹)_有效拍片量_条","横向对接(顶,底,腹)_有效拍片量_张","横隔板横向对接_计划量_条","横隔板横向对接_有效拍片量_条","横隔板横向对接_有效拍片量_张","拍片量统计_计划_总条数","拍片量统计_有效拍片量统计_条数","拍片量统计_有效拍片量统计_张数","拍片量统计_不合格拍片量统计_条数","拍片量统计_不合格拍片量统计_张数","拍片量统计_差额_条数","拍片量统计_合格率(张)"} For Each dc As Col In Tables("射线拍片_Table4").Cols If sz4.Contains(dc.Caption) dc.Visible = True Else dc.Visible = False End If Next tb4.ResumeRedraw \'恢复绘制表窗口 |
-- 作者:有点蓝 -- 发布时间:2019/9/22 22:44:00 -- 可能的原因:http://www.foxtable.com/webhelp/topics/0602.htm |
-- 作者:紫色幽魂 -- 发布时间:2019/9/22 23:21:00 -- 回复:(有点蓝)可能的原因:http://www.foxtable.co... 此主题相关图片如下:tim截图20190922232011.png 好像用法不对,应该怎么改
|
-- 作者:有点蓝 -- 发布时间:2019/9/23 8:43:00 -- 比如: .DataCols.Add("纵向对接_计划量_条",Gettype(Integer), "isnull(" & sz1(i5) & ",0) + isnull(" & sz1(i6) & ",0) + isnull(" & sz1(i7) & ",0)","纵向对接(顶,底,腹)_计划量_条") |
-- 作者:紫色幽魂 -- 发布时间:2019/9/23 8:53:00 -- 回复:(有点蓝)比如:.DataCols.Add("纵向对接_计划... 可以了,非常感谢 |