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

Type Description When to Use
Static LOVs Provides a simple list based on the values you add or import in the report
  • Using data that does not change
Dynamic LOVs based on report data Provides a dynamic list from the data Source
  • Filtering data after it has been retrieved from the database.
  • Filtering report data interactively without accessing the database.
  • Creating an LOV where it doesn't already exist in the data source. such as in a Universe or a BEx Query.
Universe LOVs Provides a list created and Maintained in the Universe.
  • Creating reusable lists of values that are managed by the Universe administrator.

How to create a Parameter?

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

Parameters1

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 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 Values1

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