9
votes

I am working on crystal reports. I want to show the sum of the record on footer of every page. so I have added the formula field in crystal reports which have below formula.

whileprintingrecords;
numbervar PageTotl;

if isNULL({Customer.PaidAmount})Then 
0
else
PageTotl:=PageTotl + {Customer.PaidAmount}

its gives error below when there are no records present with given criteria.

enter image description here

What kind of changes I have to made in above code, so it can also handle the 0 records.

1
Actually I have checked and isnull should work without any problem... can you tell if there is no data means are tables and field present in that case?Siva
Well, there is no records...ex. If I try to find the records from 15 Dec 2016 to 20 Dec 2016 then it shows this error, as there is no record exist of this date. I want to handle this kind of error.bnil
Actually I have tried your condition at my side.. suprisingly didn't face any issueSiva
Hope you have declared numbervar PageTotl; and you have no records for this condition....bnil
Check under Report Options -> Convert Database values to null option is checked. This will confirm that empty values are converted to null so that isNUll could handle it. Alternatively put 2 hardcoded strings under each condition and see which one prints in this case.aMazing

1 Answers

2
votes

First, I got the same error, After fixing the formula to the following one, no errors came out:

whileprintingrecords;
numbervar PageTotl;

if isNULL({Customer.PaidAmount})Then 
0
else
PageTotl:=PageTotl + ToNumber({Customer.PaidAmount})