Question

I have a scenario where I have 5-6 rows in Crystal Report , Columns are of type "Money" , I want to have the count of all the rows which has Column1's value "Non Zero"

Later I use that count to show in Crystal Report in "TextField"

So far I have created a Formula and typed following code

numbervar cnt;
cnt = 1;
if {MyReport;1.Cash_deposit} <> 0.00 then
  cnt = cnt +1;

Now I am unable to show this value , any body help?

Sample Data:

Cash_Deposit
--------------
10.05
 0.00
25.69
 0.00
89.47

In this case I want show (3) in my "TextField"

Was it helpful?

Solution 2

There is a syntax error...You are missing :. Change like this.

numbervar cnt;
cnt := 1;
if {MyReport;1.Cash_deposit} <> 0.00 then
  cnt := cnt +1;

Approach 1:

Why are you taking this formula instead you can use in below way.

if {MyReport;1.Cash_deposit} <> 0.00 then
     {MyReport;1.Cash_deposit};

Approach 2:

Supress the filed when count is zero

on supress formula of the section write below code:

 if {MyReport;1.Cash_deposit} = 0.00 then
 true
else false

OTHER TIPS

Create a formula:

// {@NonZero}
If {MyReport;1.Cash_deposit}<>0 Then
  1
Else
  0

Insert a summarized field; select the formula field; change summary to Count; select desired location (optionally, you can create a new group in the window).

The formula field does NOT need to be added to the canvas for this approach to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top