Chapter 4 - Selecting Records with Parameters
This chapter first shows you how to filter data using the Select Expert and then shows you how to create advance filters using parameters. Parameters are covered in great detail because they are also used within report formulas and for custom formatting. The effective use of parameters within record selection formulas and custom formatting lets you create dynamic reports that are tailored to each specific user.
| CAUTION |
|---|
| There are a few warnings associated with dynamic cascading prompts. The first is that Crystal Reports Standard edition can't create DCPs. This version can use them to prompt the user properly, but you as a report design can't use it to create DCPs in a report. The second caution is that cascading prompts must be dynamic. Static prompts can't be used. The last area of concern is that since dynamic prompts are connected to the database, the database server will be queried every time the parameters are refreshed. If a list of values is small and doesn't change frequently, you might be better off creating static parameters so that there isn't unnecessary usage of the database server. |
DCPs are backwards compatible with Crystal Reports 10, but only partially. Crystal Reports 10 can open an XI report that has DCPs, but it won't be able to display the list of values to the user. The user can manually enter parameter values and the report will use them. But the dynamic connection to the database won't be enabled.
Creating Dynamic and Cascading Prompts
Creating a parameter that uses DCPs involves entering options in the same Create New Parameters dialog box that you learned about when we were discussing static parameters. The difference being that instead of choosing the Static option you will now choose the Dynamic option. When you do so the dialog box changes to reflect new options.Creating a parameter that uses DCPs has the same steps that you've already practiced earlier in the chapter. Create a new parameter by right-clicking on the Parameter Fields node in the Field Explorer and select New Parameter. Enter the parameter name and for the List of Values option select Dynamic. With DCPs you don't specify the parameter's data type. This is because the data type is determined by the field you choose from the database.
By selecting the Dynamic option, the dialog box immediately changes to reflect the new requirements for inputting DCPs. The data type option is disabled, a new Prompt Group Text input box is displayed, and the area for entering default values changes so that you can select a data source and pick the fields to display.
Figure 4-14. Creating a new parameter using DCPs.
The Prompt Group Text input box displays the overall question that the user is presented with when they are going to enter in the parameter data. If this is a cascading prompt, it's important to enter a question that clearly conveys to the user that they will be selecting from multiple lists before getting to the final one.The option Choose a Data Source specifies which fields are the data source for the list of values. They display the data for the user to choose from. Keep the default option of New selected and click on the Insert button. It displays a list of the fields in the report's data source. You have to select a field that is in a table already referenced by the report.
| Tip |
|---|
| If the table you need isn't being used by the report, you can go back and add it to the report. Click on the Cancel button, modify the report's data source to include the necessary table, and then create the DCP again. The new table appears in the list of available data sources. |
To read all my books online, click here for the Crystal Reports ebooks.

Become a Crystal Reports expert with the authoritative resource available.
The tuturials and tips in this book will take your skills to the next level.