A parameter in JReport is a variable whose value is determined at runtime. The runtime parameters help you dynamically control your report results.
Parameter fields can be inserted in the report areas listed in Component placement. Before you can insert a parameter field into a report, you need to create it. For details about how to create parameters, see Creating a parameter.
To insert a parameter field into a report, you can use either of the following methods:
on the Insert toolbar.The Insert Fields dialog appears. See the dialog.
Select the required parameter from the Resource View panel, then drag it to the destination.
When a parameter field has been inserted into a report, you can customize its appearance and behavior by setting properties in the Report Inspector, which can be saved as a CSS style for future use (for details, see Creating a CSS style).
Notes:
The display type of a parameter field can be changed, that is to say, you can map the parameter field to another value or image to be displayed instead.
To change the display type a parameter field:
A parameter field can be bound with some web actions. This allows you to customize a parameter field to make it respond to some events, and execute corresponding actions, such as sorting and filtering.
To apply web actions to a parameter field:
that appears in the text box.
in the Display Type dialog to add more web behavior lines and specify the events and actions accordingly. If a web behavior is not required, click
to remove it.
or
. Then, when an event that has been bound with more than one action happens, the upper action will be triggered first.For more information about web actions, see Applying web actions to a label.
You can make a parameter field linked with another report, a location specified by a URL, an e-mail address, or a Blob data type field. The link can either be a simple link or a conditional link. With conditional link, different targets can be loaded based on different conditions.
To bind a link to a parameter field:
For details about different link targets, see Binding a link to a label.
You can add some conditional formats to a parameter field, then when a specified condition is fulfilled, the format bound with the condition will be applied to the field values automatically for distinguishing.
To add conditional formats to a parameter field:
to add a condition.For more details about conditional formatting, see Adding conditional formats to a DBField.
See an example: The SampleComponents catalog, included with JReport Designer, contains reports that have examples of how each component type could be used in a report. For the parameter field examples, open the following reports: <install_root>\Demo\Reports\SampleComponents\Parameter.cls, and <install_root>\Demo\Reports\SampleComponents\ParameterField.cls.