以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  组合条件表达  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=110461)

--  作者:kaituozhe
--  发布时间:2017/12/3 20:48:00
--  组合条件表达

确定计算条件时,有部分条件是相同,希望通过组合减少代码量,确定如下:该怎么修改?

 

 

Dim filter As String = "年度 = \'"& e.datarow("年度") & "\' and 期间 = \'"& e.datarow("期间") & "\'and 单位名称 = \'"& e.datarow("单位名称") & "\'and  明细 = \'是\' and 会计准则 = \'"& e.datarow("会计准则") & "\'"
Select Case e.DataCol.name
    Case "资产项目"
        msgbox("filter And 资产项目 = \'货币资金\'")
        e.DataTable.find(filter And "资产项目 = \'货币资金\'")("资产期初金额") = DataTables("三栏明细").Compute("sum(期初金额)","filter And and 科目编号 in (\'1001\',\'1002\') ")
       
End Select


--  作者:kaituozhe
--  发布时间:2017/12/3 20:49:00
--  

上述代码提示错误如下:

.NET Framework 版本:2.0.50727.8689
Foxtable 版本:2017.10.26.1
错误所在事件:表,资产负债,DataColChanged
详细错误信息:
调用的目标发生了异常。
从字符串“年度 = \'2015\' and 期间 = \'01\'and 单位名”到类型“Long”的转换无效。
输入字符串的格式不正确。


--  作者:有点甜
--  发布时间:2017/12/3 23:03:00
--  

Dim filter As String = "年度 = \'"& e.datarow("年度") & "\' and 期间 = \'"& e.datarow("期间") & "\' and 单位名称 = \'"& e.datarow("单位名称") & "\' and 明细 = \'是\' and 会计准则 = \'"& e.datarow("会计准则") & "\'"
Select Case e.DataCol.name
    Case "资产项目"
        msgbox(filter & " And 资产项目 = \'货币资金\'")
        e.DataTable.find(filter " And 资产项目 = \'货币资金\'")("资产期初金额") = DataTables("三栏明细").Compute("sum(期初金额)", filter & " and 科目编号 in (\'1001\',\'1002\') ")
       
End Select


--  作者:kaituozhe
--  发布时间:2017/12/10 20:00:00
--  

以下代码怎么错误了呀?提示错误

Dim Pzdr As DataRow = DataTables("凭证明细").sqlfind(filter " And 贷方金额 = \'" & e.DataRow("集资情况_合同金额") & "\'")


--  作者:有点甜
--  发布时间:2017/12/10 20:56:00
--  
报什么错?你filter的代码是什么?弹出看看 msgbox(Filter)