Crystal Reports - Parameters


Advertisements


Parameters are used to take user inputs before the report is generated. User has to answer the prompt before the report is generated and the report output depends on the response of the user for the parameter value.

By using parameters with formulas and in the report, you can create a single report that changes according to the requirement of different users.

LOVs can be used to enter prompt values in parameters. LOVs can be either static or dynamic. They can also be used as single level dynamic prompts or multilevel prompts.

Note − Parameters in Crystal Reports can be used in filters after it is retrieved from the database.

Cascading Parameters

Parameters with dependency are grouped together and are known as cascading parameters. Cascading parameters allow you to group two or more parameters in a single group.

Inherited Parameters

Parameters can also be created at universe level or in query panel and they can be later inherited into Crystal Reports. They are called inherited parameters. These parameters can be dropped at the report level but they can’t be edited in a report. These parameters can only be edited where they are created.

Parameter Data Types

Parameters in Crystal Report support below data types −

  • Number
  • String
  • Date
  • Time
  • DateTime
  • Currency
  • Boolean
  • Member

Important points to remember while using Parameters −

  • To use parameter in a formula, it is not necessary to be placed in the report. Parameters can be used in a formula like other objects and can be created in the Formula workshop.

  • Parameters can be used with static or dynamic LOVs.

  • You can also create a list of values from which the user can choose the parameter value instead of entering it manually.

List of Values Types

List of Values Types

How to create a Parameter?

In Data Explorer view, right-click within the Parameters area → select New → New Parameter

Create a Parameter

The Create Parameter dialog box appears → Enter a name for the parameter (up to 255 alphanumeric characters). In the dialog box, you can change the name and type of the parameter along with other properties.

Select the appropriate Data Type from the list → such as String, Number, or Date, among others.

Create a Parameter

In the Prompt Text box, enter the desired prompting text (up to 255 alphanumeric characters).

For example: "Select a Name"

This text will appear in the prompting dialog box when you preview the report, or when you refresh the data on the Page area.

To create a list of values, click the ellipsis button → The Edit List of Values dialog box appears → Enter the values that you want to see when you are prompted → you might add a list of countries for a String type, or a list of values for a Number type → click OK → You return to the Create Parameter dialog → click OK and drag the parameter to your Report.

Edit Values

Edit Values 1

Customer Details

Once the parameter is dragged to the structure of report, you can go to page tab to see LOVs selected while refreshing the report data.



Advertisements