以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  表属性代码引用表达式列  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=151859)

--  作者:爱相随
--  发布时间:2020/7/6 9:57:00
--  表属性代码引用表达式列
老师,在表属性的代码里不能引用列属性为表达式的列吗?用什么方法可以引用呢!!
If e.DataCol.Name = "zwbm" Then  
    Dim filter1 As String = "zwbm = \'" & e.DataRow("zwbm")  & "\' And nd = \'" & e.DataRow("nd") & "\'And yf = \'" & e.DataRow("yf") & "\'"
    e.DataRow("byxz") = DataTables("xzxymxb").Compute("sum(byxz)",filter1 ) 
    e.DataRow("byfk") = DataTables("xzfkmxb").Compute("sum(byfk)",filter1 ) 
    e.DataRow("byzh") = DataTables("hbmxb").Compute("sum(hkje)",filter1 ) + DataTables("gckzfmxb").Compute("sum(zfje)",filter1 )
    e.DataRow("byzf") = DataTables("lxmxb").Compute("sum(zfje)",filter1 ) 
End If
(byxz)、(byfk)、(hkje)、(zfje)这些列都是表达式列,在项目打开时,提示这些列无效!!
[此贴子已经被作者于2020/7/6 9:58:36编辑过]

--  作者:有点蓝
--  发布时间:2020/7/6 9:58:00
--  
可以引用。请举例说明具体问题
--  作者:爱相随
--  发布时间:2020/7/6 9:59:00
--  
If e.DataCol.Name = "zwbm" Then  
    Dim filter1 As String = "zwbm = \'" & e.DataRow("zwbm")  & "\' And nd = \'" & e.DataRow("nd") & "\'And yf = \'" & e.DataRow("yf") & "\'"
    e.DataRow("byxz") = DataTables("xzxymxb").Compute("sum(byxz)",filter1 ) 
    e.DataRow("byfk") = DataTables("xzfkmxb").Compute("sum(byfk)",filter1 ) 
    e.DataRow("byzh") = DataTables("hbmxb").Compute("sum(hkje)",filter1 ) + DataTables("gckzfmxb").Compute("sum(zfje)",filter1 )
    e.DataRow("byzf") = DataTables("lxmxb").Compute("sum(zfje)",filter1 ) 
End If
(byxz)、(byfk)、(hkje)、(zfje)这些列在其他表都是表达式列,在项目打开时,提示这些列无效!!(最开始是数据列,后面更改为表达式列后打开项目就提示列无效)
[此贴子已经被作者于2020/7/6 10:00:47编辑过]

--  作者:有点蓝
--  发布时间:2020/7/6 10:12:00
--  
在项目打开时,提示这些列无效这这个代码没有什么关系,上面代码肯定是可以使用的。

在项目打开时,检查项目事件、加载树、外部表设置等等

--  作者:爱相随
--  发布时间:2020/7/6 11:30:00
--  

老师,窗口的AfterLoad事件中涉及上述表达式列,是否影 响,因为项目 事件中没有代码涉及到。


--  作者:爱相随
--  发布时间:2020/7/6 11:35:00
--  
.NET Framework 版本:2.0.50727.8806
Foxtable 版本:2017.6.12.1
错误所在事件:
详细错误信息:
列名 \'byfk\' 无效。
没有说明是哪个事件的代码引起的无效

--  作者:有点蓝
--  发布时间:2020/7/6 11:35:00
--  
代码?
--  作者:爱相随
--  发布时间:2020/7/7 10:27:00
--  
窗口的AfterLoad事件中的代码,只截了一部分用到的(byfk)就是引用表的表达式列
Dim dt7 As New Date(y, 1, 1)
Dim dt8 As New Date(y, 12, 31)
Dim Filter3 As String
Dim Filter4 As String
Filter3 = "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'"
Filter4 = "rq < \'" & dt7 & "\'"

Dim cnt1 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt1 & "\' And rq <= \'" & dt2 & "\'And zwlx = \'公益性项目债务\'")
Dim cnt2 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt1 & "\' And rq <= \'" & dt2 & "\'And zwlx = \'非项目债务\'") + DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt1 & "\' And rq <= \'" & dt2 & "\'And zwlx = \'经营性项目债务\'") 
Dim cnt3 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt1 & "\' And rq <= \'" & dt2 & "\'And zwlx = \'棚改项目\'")
Dim cnt4 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt1 & "\' And rq <= \'" & dt2 & "\'")
Dim cnt5 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt3 & "\' And rq <= \'" & dt4 & "\'And zwlx = \'公益性项目债务\'")
Dim cnt6 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt3 & "\' And rq <= \'" & dt4 & "\'And zwlx = \'非项目债务\'") + DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt3 & "\' And rq <= \'" & dt4 & "\'And zwlx = \'经营性项目债务\'")  
Dim cnt7 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt3 & "\' And rq <= \'" & dt4 & "\'And zwlx = \'棚改项目\'")
Dim cnt8 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt3 & "\' And rq <= \'" & dt4 & "\'")
Dim cnt9 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt5 & "\' And rq <= \'" & dt6 & "\'")
Dim cnt10 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt5 & "\' And rq <= \'" & dt6 & "\'And zwlx = \'公益性项目债务\'")
Dim cnt11 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt5 & "\' And rq <= \'" & dt6 & "\'And zwlx = \'非项目债务\'") + DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt5 & "\' And rq <= \'" & dt6 & "\'And zwlx = \'经营性项目债务\'")  
Dim cnt12 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt5 & "\' And rq <= \'" & dt6 & "\'And zwlx = \'棚改项目\'")
Dim cnt13 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'")
Dim cnt14 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'公益性项目债务\'")
Dim cnt55 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'公益性项目债务\'And zwlb = \'贷款融资\'")
Dim cnt56 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'公益性项目债务\'And zwlb = \'应付工程款\'") 
Dim cnt15 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'非项目债务\'") + DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'经营性项目债务\'") 
Dim cnt57 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'非项目债务\'And zwlb = \'贷款融资\'") + DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'经营性项目债务\'And zwlb = \'贷款融资\'") 
Dim cnt58 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'非项目债务\'And zwlb = \'应付工程款\'") + DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'经营性项目债务\'And zwlb = \'应付工程款\'")  
Dim cnt16 As Integer = DataTables("xzfkmxb").sqlCompute("sum(byfk)/10000" , "rq >= \'" & dt7 & "\' And rq <= \'" & dt8 & "\'And zwlx = \'棚改项目\'")

[此贴子已经被作者于2020/7/7 10:27:40编辑过]

--  作者:爱相随
--  发布时间:2020/7/7 10:30:00
--  
就是将原来是数据列的列改为表达式列后,打开项目就会提示“XX”列无效,又没指定是哪个事件的代码导致的
--  作者:有点蓝
--  发布时间:2020/7/7 10:54:00
--  
Compute可以使用表达式列。sqlCompute不可以使用表达式列,因为sqlCompute是直接查询数据库的,数据库不存在表达式列