Click here to Skip to main content
15,306,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,
I facing problem for sum the data in column of crystal report.
This is my code. @Discrate is the data from database. Its datatype is decimal.
{DataTable1.TotalPrice} is also from database. Its datatype is also decimal.
numbervar discrate :=ToNumber({@Discrate});
if discrate = 0.00 then

In my columns, I will display only data where @Discrate is 0.00.
So now my problem is how can I sum the {DataTable1.TotalPrice} Where @Discrate =0.00?

1 solution

Modify formula like this...
Global numbervar SumOfTtlPrice;

numbervar discrate := ToNumber({@Discrate});
if discrate = 0.00 then
    SumOfTtlPrice := SumOfTtlPrice + {DataTable1.TotalPrice};

dragdrop it in detail section

Now To print SumOfTtlPrice create another formula name it PrintSumOfTtlPrice
Global numbervar SumOfTtlPrice;

drag drop it in footer section

Happy Coding!

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