Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

16.04 Parameter Class Approaches

The parameter classes are designed with two approaches in mind. The first approach is that you are using the CrystalReportViewer control to preview the report. The second approach is modifying parameters with the ReportDocument object. Both approaches can be used to modify the current value or the default values. But they do so in different ways.

The object model in Figure 16-1 shows two columns of classes. The left column has the classes related to the ReportDocument object. The right column has the classes for the CrystalReportViewer class. At the bottom of the diagram are the classes that store the actual parameter values. These classes are shared by both columns.





Figure 16-1. The classes of the Parameter object model.

When looking at the individual classes of both columns in more detail, you see that there are a lot of similarities between them. Let’s start at the top and work our way down. The top most classes are the ReportDocument class and CrystalReportViewer class. Below the ReportDocument class is the DataDefinition class. Below each class is a collection class that stores the parameters. Under the collection class is the actual parameter field class. The two parameter field classes, ParameterFieldDefinition and ParameterField, have all the properties that you set when using the Create New Parameter dialog box in design mode (e.g. prompt text, min and max values, sort order, etc.). You can see that they have many properties in common.

The parameter field classes use a collection class to store the current values and the default values. The ParameterValues collection holds ParameterValue objects. Since the current value and default value of a parameter can store either a single discrete value or a range of values, there are two classes that are used to represent this. The ParameterDiscreteValue class only holds a single value. The ParameterRangeValue class stores a range value (it has an upper and lower range).

All of the parameter classes have a variety of properties that are enumeration data types. These enumerations are used to store a pre-determined set of values that the property can have. Since there are so many of the enumeration types, they are listed separately from the main parameter object model. See Figure 16-2 for each enumeration used. Since these represent the options that you can set for a parameter, they have already been discussed earlier in Chapter 5.





Figure 16-2. The enumeration constants of the Parameter object model.