以文本方式查看主题

-  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=170926)

--  作者:ganlan
--  发布时间:2021/8/11 16:01:00
--  两个条件变动求和
If e.DataCol.Name = "类别"  or e.DataCol.Name = "所属月份" Then 
    If e.NewValue Is Nothing Then 
        e.DataRow("金额") = Nothing 
    Else
        e.DataRow("金额") =  DataTables("资金流水").Compute("sum(交易金额)","[类别] = \'" &  e.NewValue & "\' and 计入月份 = \'" &  e.NewValue & "\'")
    End If
End If


请教一下,想以类别和月份两个条件求和的,需要怎么填代码呀

--  作者:有点蓝
--  发布时间:2021/8/11 16:08:00
--  
If e.DataCol.Name = "类别"  or e.DataCol.Name = "所属月份" Then 
    If e.DataRow.isnull("类别") orelse e.DataRow.isnull("所属月份") Then 
        e.DataRow("金额") = Nothing 
    Else
        e.DataRow("金额") =  DataTables("资金流水").Compute("sum(交易金额)","[类别] = \'" &  e.DataRow("类别") & "\' and 计入月份 = \'" &  e.DataRow("所属月份") & "\'")
    End If
End If