如何计算水晶报表中if语句下的所有数据 [英] How to count all data under if statement in crystal report
本文介绍了如何计算水晶报表中if语句下的所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
关于水晶报告我想做类似的事情:
计算属于我的IF声明的所有数据
on crystal report I want to do something like :
Counting all data that falls under my IF Statement
numbervar thisLetterA;
if {V_RepairInv.Type} = "A" then
thisCount := thisCount + 1;
上面这个公式是在按摩,但是我在这个条件下创建了另一个公式:
this above formula is woking, but whent I create another formula with the condition like this:
numbervar thisLetterD;
if {V_RepairInv.Type} = "D" then
thisCount := thisCount + 1;
结果为0,即使结果显示为2.
应该在这里做什么?
the result is 0 even if the result should display 2.
what supposed to be done here?
推荐答案
以下是样本数据
| emp_user | |类型|
user1 D
user2 D
user3 A
< br $>
行数:3
A的数量:1
D的数量:2
Here's the sample data
|emp_user| |Type|
user1 D
user2 D
user3 A
No. of Rows : 3
No. of A : 1
No. of D : 2
我解决了这个问题,虽然我希望得到其他解决方案。
无论如何这里是:
我先创建一个公式
@countA
I solve the problem, though Im hoping for other solution I guess.
Anyway here it is:
I first create a formula
@countA
if {V_RepairInv.Type} = 'A' or {V_RepairInv.Type} = 'a'
then 1
else 0
@countB
@countB
if {V_RepairInv.Type} = 'B' or {V_RepairInv.Type} = 'b'
then 1
else 0
我把它放在报告的'DETAIL'部分。
然后我创建了另一个公式
@countTYPEA
I put this on the 'DETAIL' part of the report.
And then I created another formula
@countTYPEA
sum({@@countA})
@countTYPEA
@countTYPEA
sum({@@countA})
并将其放在报告页脚上。
and placed it on the report footer.
这篇关于如何计算水晶报表中if语句下的所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文