Manual conditional calculations in Crystal Reports


'Code by Kiran Reddy
'Manual conditional calculations in Crystal Reports
'Ruining totals are very easy but some times you may need to calculate results manually.
'Create three formulas called form1, form2 and form3
'Keep form1 on report header, form2 on your section and form3 on report footer
'Add following code to your formulas


'Form1
WhilePrintingRecords;
numberVar gtotbasedon:= 0;

'Form2
WhilePrintingRecords;
numberVar gtotbasedon;
if {YOUR.FIELD}= YOUR_CONDITION then
gtotbasedon := gtotbasedon + {YOUR.FIELD}
else
gtotbasedon := gtotbasedon;

'Form3
WhilePrintingRecords;
numberVar gtotbasedon;
gtotbasedon := gtotbasedon


You can view this article online at:
http://www.kiranreddys.com/knowledgebase/index.php/article/manual-conditional-calculations-in-crystal-reports