Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

4.18 Multiple, Discrete and Range Values

Multiple, Discrete and Range Values

A parameter has the flexibility to store a single value, a range of values, or a combination of the two. This gives you a lot to think about when deciding which is appropriate for each parameter. Since these three options can be used in conjunction with each other, it’s best to get an overall understanding of them at the same time.

Discrete parameters are good when you need to store a single value. An example is when you want to print a report based on a Company ID. Another example is storing a Boolean value that determines when a report feature is to be displayed or hidden.

Range values give you more flexibility by allowing you to set a start and end point of acceptable values. Any value that falls within this range is included. This is useful when you want to print multiple values and these values have a definite starting point and ending point. Range values are frequently used when filtering dates because you can set the beginning and ending dates and all dates in between get included.

Parameters let you go one step further by combining both discrete values and range values into the same parameter. These are called multi-value parameters. A multi-value parameter is a list of different values (i.e. an array of values). This gives the user the ability to create a list of acceptable values that can be discrete values, range values, or a combination of the two. This can result in a complex list of acceptable values. For example, consider financial reports which are often based on account codes. Each type of account category (assets, liabilities, etc.) is represented by a starting and ending range. An auditor that is investigating fraudulent information could print out certain related accounts by entering multiple account codes such as 10000-11000, 50000-51000, and the individual accounts 05928 and 05970. The multi-value parameter lets all the accounts be printed on the same report for easier analysis. If the report didn’t use a multi-value parameter, then each of these accounts and account ranges would have to be printed on a separate report and pieced together. Table 4-3 shows a summary of the different type parameter options.

Table 4-3. Options for parameter fields

Option Description
Discrete value(s) The user must enter a single value.
Range value(s) The user enters two the start and end points of a range. The range will include the values entered. For example, if you entered a range of 1,000 and 1,999 then it would include all numbers from 1,000 up to and including 1,999. The numbers 999 and 2,000 would not be included.
Allow multiple values Allows a parameter to accept discrete and range values and store them as a series.

Now that you understand the different data types and options available for parameters, let’s look at how to create parameters in a report.