以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  相似取数  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132578)

--  作者:爱相随
--  发布时间:2019/3/25 12:26:00
--  相似取数
老师,我表A有列名为“科目代码”,其规则是1001、1002、1004等都是四位数的,在表B有列名为“科目名称”,科目名称中包含表A的“科目代码”。比如表B的科目名称为100101\\现金\\人民币;100102\\现金\\美元。现在我要在表A的科目代码为1001的行统计表B中科目名称中包含1001的合计数据。下面是我的代码,得到的结果全是0
If e.DataCol.Name = "科目代码" OrElse e.DataCol.Name = "年度" OrElse e.DataCol.Name = "月份" Then
    Dim Str1 As String = e.DataRow("科目代码")
    If Str1 > "" AndAlso Str1.Contains(e.DataRow("科目名称")) Then
        Dim filter1 As String = "年度 = \'" & e.DataRow("年度") & "\' And 月份 <= \'" & e.DataRow("月份") & "\'"        
        e.DataRow("借方本期") = DataTables("凭证明细表").Compute("sum(借方金额)" ,filter1 And "科目代码 Like & value &")
    Else
        e.DataRow("借方本期") = 0
    End If
End If
再麻烦老师。。。实在不好意思。。。

--  作者:有点甜
--  发布时间:2019/3/25 14:19:00
--  
 
 
If e.DataCol.Name = "科目代码" OrElse e.DataCol.Name = "年度" OrElse e.DataCol.Name = "月份" Then
    Dim Str1 As String = e.DataRow("科目代码")
    If Str1 > "" AndAlso Str1.Contains(e.DataRow("科目名称")) Then
        Dim filter1 As String = "年度 = \'" & e.DataRow("年度") & "\' And 月份 <= \'" & e.DataRow("月份") & "\'"        
        e.DataRow("借方本期") = DataTables("凭证明细表").Compute("sum(借方金额)" ,filter1 & " And 科目代码 Like \'%" & Str1 & "%\'")
    Else
        e.DataRow("借方本期") = 0
    End If
End If

--  作者:爱相随
--  发布时间:2019/3/25 16:34:00
--  
谢谢老师,感觉自已呢业务思维,没有编程天赋啊。。。