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 which is 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 - Advanced Properties

The Default Value Expression field allows you to set a 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.

The parameter Description is not used directly by JasperReports, but like the Is for Prompting, may be passed to an external application.

As with fields, you may 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, the designer can use properties to include the description of the parameter in different languages or perhaps add instructions about the format of the input prompt.