Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

16.01 Introduction to Formulas and Parameters

There is a bug in Crystal Reports that will wipe out any changes you make to parameters or formulas IF you make them prior to calling the SetDataSource() method of the ReportDocument object. To ensure that your parameter/formula changes are saved with your report, you need to make sure your code comes AFTER calling the SetDataSource() method.

Formulas and parameters are the two primary ways of customizing reports. Formulas let you create new calculations using existing report date as well as customizing the report’s formatting. Parameters allow the user to specify the report criteria and customize each report according to their needs. This lets the report be tailored for each user printing it.

The Crystal Reports object model makes it easy for you to modify both formulas and parameters within your application. By calling a couple simple methods, you can use data from your application to override the report’s existing formulas and parameter values. This makes it possible to apply an application’s business rules across one or more reports with very little effort. The remainder of this chapter shows you the steps for overriding a report’s functions and parameter values.