Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
on crystal report I want to do something like :


Counting all data that falls under my IF Statement


CSS
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:

CSS
numbervar thisLetterD;
if {V_RepairInv.Type} = "D" then
thisCount := thisCount + 1;



the result is 0 even if the result should display 2.
what supposed to be done here?
Posted
Comments
Kschuler 14-Aug-14 9:10am    
Can you give us a sample of your data? Perhaps your data has a lower case "d" instead of a capital "D"?
guardj 14-Aug-14 21:29pm    
I set it to only uppercase.

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
 
Share this answer
 
I solve the problem, though Im hoping for other solution I guess.

Anyway here it is:

I first create a formula

@countA

SQL
if {V_RepairInv.Type} = 'A' or {V_RepairInv.Type} = 'a'
then 1
else 0


@countB

SQL
if {V_RepairInv.Type} = 'B' or {V_RepairInv.Type} = 'b'
then 1
else 0


I put this on the 'DETAIL' part of the report.
And then I created another formula

@countTYPEA

SQL
sum({@@countA})


@countTYPEA

SQL
sum({@@countA})


and placed it on the report footer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900