Managing Parameters

Parameters are the best communication channel between the report engine and the execution environment (your application).

A parameter can have a default value defined by means of the default expression property. This expression is evaluated by JasperReports only when a value for the parameter has not been provided by the user at run time.

Parameters in Outline View

To manage parameters, use the outline view. Add a parameter by right-clicking on the item Parameters and choosing Create Parameter. To delete a parameter from the outline view right click on it and select Delete. The parameters with light gray names are created by the system and can not be deleted or edited.

Right-click any parameter and choose Show Properties to view and edit the properties of the parameter.

Parameters - Properties

Parameters have the following properties on the Object tab:

Name – Name of the parameter.
Class – Class type of the parameter.
Default Value Expression – Pre-defined value for the parameter. This value is used if no value is provided for the parameter from the application that executes the report. The type of value must match the type declared in the Class field.

You may legally define another parameter as the value of Default Value Expression, but this method requires careful report design. Jaspersoft Studio parses parameters in the same order in which they are declared, so a default value parameter must be declared before the current parameter.

Description – A string describing the parameter. The description is not used directly by JasperReports, but may be passed to an external application.
Is for Prompting – Enable this to have Jaspersoft Studio prompt for the parameter when the report is executed. May also be passed to an external application.

On the Advanced tab, you can use the Properties field to specify pairs of type name/value as properties for each parameter. This is a way to add extra information to the parameter for use by external applications. For example, you can use properties to include the description of the parameter in different languages or to add instructions about the format of the input prompt.

Feedback
randomness