13,045,564 members (72,952 online)
Rate this:
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

Rate this:

## Solution 1

Modify formula like this...
```[__u__]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!
:)

Top Experts
Last 24hrsThis month
 OriginalGriff 288 Graeme_Grant 145 ppolymorphe 104 Atlapure Ambrish 80 kp564 70
 OriginalGriff 4,713 RickZeeland 1,854 ppolymorphe 1,708 F-ES Sitecore 1,553 Dave Kreskowiak 1,349