Home > Articles > Data > BusinessObjects/Crystal Reports

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Creating and Implementing Dynamic and Cascading Parameters

New to version XI, Crystal Reports now provides the ability for report parameters to be based on dynamic values derived directly from a database or from the BusinessObjects Enterprise repository (if using BusinessObjects Enterprise). This new functionality enables end users to select from the most recent list of elements dynamically retrieved from the database at run time.

An additional new powerful feature provided in version XI is the ability to link these dynamic parameters together in a cascading manner. These cascading parameters enable end users to select parameter values by entering information at multiple levels, with all levels leading to dynamic filters being applied to all subsequent level parameters. The most common example of this is where a City parameter might be filtered based on the linked Country parameter as described earlier in the chapter. Specifically, if Canada is the only country selected, only cities in Canada are available for selection in the linked City parameter. These dynamic, cascading parameters are set through the same Create Parameter dialog used for static parameters.

The following steps will take you through a practical example of the creation and implementation of a dynamic, cascading set of prompts:

  1. Open the sample Chap5 report or the one you have previously created in this chapter, and after removing the Country record selection and the Top N Value formula, delete the existing Countries parameter.
  2. Create a new Parameter called Cities with type String and select the Dynamic List of Values type.
  3. Ensuring the New radio button is selected, click on the Value field of the parameters table and you are prompted with a drop-down list box where the Country field from the Customer table is selected.
  4. Ensure the Allows Multiple Values property is set to True and the Allows Custom Values property is set to False. You have now created Country as the highest level parameter of this group.
  5. Now click on the Value field in the next row of the parameters table and you will be prompted with a drop-down list where you select the City field from the Customer table. Ensure the Allows Multiple Values property is set to True and the Allows Custom Values property is set to False. You have now created City as the second and currently lowest-level parameter of this group.
  6. To complete the parameter creation process, click on the Parameters fields for each of the Country and City rows in the parameter table. The prompting text of Click to Create a Parameter changes to the specific parameter name consisting of the top level parameter name suffixed by the involved field name. Figure 5.13 highlights what this should look like.
    Figure 5.13

    Figure 5.13 The Create/Edit Parameter dialog enables rapid creation of dynamic and cascading parameters.

  7. Now add a new record selection through the Record Select Expert that filters the report where the City field from the customer table is equal to the newly created parameter {?Cities – City}.
  8. Finally, refresh the report and you are faced with the parameter selection screen shown in Figure 5.13. Note that as you add countries to the list of countries selected in the Cities parameter group, the list of available cities in the City parameter is dynamically filtered. After testing the filtering process, select USA, Canada, and Ireland as countries with only Las Vegas, Philadelphia, Vancouver, Toronto, and Dublin as selected cities. Click OK and your report resembles something similar to Figure 5.14.
Figure 5.14

Figure 5.14 The new dynamic and cascading parameter feature enables increased productivity in report design and a better end-user experience.

This new powerful cascading parameter feature enables increased end-user productivity through reduced and focused selection sets. When designing reports, careful consideration should be given to use of these dynamic and cascading parameters versus the static parameters. Dynamic parameters are ideally geared for data sets that change frequently. Static parameters might be best used when the involved list of values does not change often because no additional database hits will be required.

  • + Share This
  • 🔖 Save To Your Account