如何根据IF条件对Crystal Reports中的字段求和? [英] How can I sum a field in Crystal Reports based on an IF Condition?
问题描述
朋友们,您好。
我在水晶报告中有三个公式字段如下:
sumAccrued
sumDeducted
sumPaid
我在交易表格中有一个名为金额的栏目
如果单元格内容='Accrued'则sumAccrued
如果单元格内容='Deducted'则sumDeducted
如果单元格内容= '付费'然后sumPaid
我在公式字段中完成了这些代码:
if { Table1.Type} ='Accrued'然后SUM({Table1.Amount})
如果{Table1.Type} ='Deducted'则SUM({Table1.Amount})
如果{Table1.Type} ='付费',那么SUM({Table1.Amount})
,但它在报告查看器中显示0.00 !!
错误是什么?
Hello, friends.
I've three formula fields in crystal reports as follows:
sumAccrued
sumDeducted
sumPaid
and I have a column called "Amount" in the table "Transactions"
if the cell content = 'Accrued' then sumAccrued
if the cell content = 'Deducted' then sumDeducted
if the cell content = 'Paid' then sumPaid
I've done these codes in the formula fields:
if {Table1.Type} = 'Accrued' then SUM({Table1.Amount})
if {Table1.Type} = 'Deducted' then SUM({Table1.Amount})
if {Table1.Type} = 'Paid' then SUM({Table1.Amount})
but it shows 0.00 in the report viewer!!
what is the error?
推荐答案
条件总样本可以帮助你 - 使用If-Then-Else公式的条件总计 [ ^ ]。
您还可以使用公式进行评估 - 如何在CR中实现条件求和? [ ^ ]。
A conditional total sample should help you - Conditional Total using an If-Then-Else formula[^].
You can also evaluate using a formula - How to implement conditional sum in CR?[^].
这篇关于如何根据IF条件对Crystal Reports中的字段求和?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!