Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

4.20 Managing the Parameter List

Managing the Parameter List

After adding a parameter to the report, you often need to modify it. This could be renaming it or changing its options. As you might expect, Crystal Reports lets you perform the typical maintenance tasks with parameters. You can modify them, delete them, rename them and reorder them.

All the tasks for working with parameters are in the pop-up menu that appears when you right-click on a parameter in the Field Explorer window. To edit a parameter, select the Edit option from the pop-up menu and it opens the Edit Parameter dialog box that you’ve been working with in this chapter. Make the necessary changes and click the OK button to save it.

To delete a parameter select the Delete option from the pop-up menu. Prior to deleting a parameter, make sure that there isn’t a checkmark next to its name indicating that the report is using it. If there is a checkmark, Crystal Reports gives you an error that it is still being used and it can’t be deleted. Make sure no formulas are using the parameter prior to deleting it.

Question: I have a large report and sometimes I can’t determine where the parameter is being used. Do I have to search through every formula to find which one is using a parameter field?

Answer: If you can’t find the parameter in the list of formulas, also check the record selection formula or the subreport links (if it has a subreport). It might be hiding in one of these places. There is a “trick” to make Crystal Reports tell you every formula that is using the parameter. Simply edit the parameter and change its data type. When you run the report Crystal Reports will tell you that there is a data type error and show you the formula using that parameter. Remove the parameter from the formula(s) and you will be able to delete the parameter field from the report.

If you wish to rename the parameter, you have to select the Rename option. Interestingly enough, if you try to rename the parameter within the Edit Parameter dialog box it won’t let you do it. The dialog box has the parameter name as a read-only property that you can’t change. You are only allowed to rename the parameter using the pop-up menu.

When you rename a parameter field, Crystal Reports automatically finds all references to the parameter and updates them to use the new name.

When a user opens a report with parameters, the parameters are listed within the same dialog box. You may not have given much thought to the order that the parameters are listed in, but they are listed in the order that you created them. In fact, if you look at the Parameter Fields list in the Field Explorer window, you’ll see that their order in the Parameters Fields list is how they appear to the user. You can reorder the parameters so that the more important parameters are listed first. Right-click anywhere on the Parameter Fields list and select the option Set Parameter Order. The Parameter Order dialog box appears and shows you a list of every parameter in the report.



Figure 4-12. Change the parameter order with the Parameter Order dialog box.

To change the parameter order, click on the parameter you wish to move and then click on the up and down arrows located in the top right corner. Click OK to save your changes and you’ll see that the Parameter Fields list is updated to reflect the new order.