12,502,005 members (55,383 online)
Rate this:
Please Sign up or sign in to vote.
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
cstr({DataTable1.TotalPrice})```
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?
Posted 1-Jan-13 16:02pm
Des DC533

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Modify formula like this...
```Global numbervar SumOfTtlPrice;

numbervar discrate := ToNumber({@Discrate});
if discrate = 0.00 then
(
SumOfTtlPrice := SumOfTtlPrice + {DataTable1.TotalPrice};
cstr({DataTable1.TotalPrice});
)
```
dragdrop it in detail section

Now To print SumOfTtlPrice create another formula name it PrintSumOfTtlPrice
```WhilePrintingRecords;
Global numbervar SumOfTtlPrice;
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)

Top Experts
Last 24hrsThis month
 David_Wimbley 160 OriginalGriff 155 ppolymorphe 110 Mika Wendelius 80 Karthik Bangalore 75
 OriginalGriff 6,678 ppolymorphe 3,779 Maciej Los 3,333 David_Wimbley 2,812 Karthik Bangalore 2,664

Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100