BackPrevious Page Next PageNext

Parameter Fields

Inserting a parameter field in a report

Changing the display type of a parameter field

Applying web actions to a parameter field

Binding a link to a parameter field

Adding conditional formats to a parameter field

A parameter in JReport is a variable whose value is determined at runtime. The runtime parameters help you dynamically control your report results.

Inserting a parameter field in a report

Parameter fields can be inserted in the report areas listed in Component placement.

To insert a parameter field into a report, select the required parameter from the Data panel, then drag it to the destination. If the given parameters are not what your want, click the <New Parameter...> item to create one as required. For a business view based report, you can create local parameters to use in the report specifically.

For a query based report, you can also use dialog to insert a parameter field into it as follows:

  1. Position the mouse pointer at the destination where you want to insert the parameter and click Insert > Parameter or Home > Insert > Parameter.

    The Insert Fields dialog appears.

    Insert Field dialog

  2. Select the required parameter from the Parameters node, then specify its layout in the Insert Layout box.
  3. Click the Insert button to insert the parameter into the destination.

Note: If you insert a parameter into the detail panel of a banded object or table, the name of the parameter will automatically be inserted as a label into the corresponding header panel. Otherwise the parameter and its name label will be placed in the same panel. If you do not want to insert the name label automatically, you can uncheck Insert field name label with field in the Options dialog (File > Options > Component > Insert field name label with field).

Changing the display type of a parameter field

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:

  1. Right-click the parameter field and select Display Type from the shortcut menu.
  2. In the Display Type dialog, specify the required display type in the Display As box, and set the options for the selected type.
  3. Upon finishing, click the OK button to close the dialog.

Applying web actions to a parameter field

A parameter field can be bound with web actions. This allows you to customize a parameter field to make it respond to interactive events, and execute corresponding actions, such as sorting and filtering.

To apply web actions to a parameter field:

  1. Right-click the parameter field and select Display Type from the shortcut menu.
  2. In the Web Behaviors box of the Display Type dialog, choose an event from the Events column, then click in the Actions column and click Choose button that appears in the text box.
  3. In the Web Action List dialog, select a web action and define the action as required.
  4. Click Add button 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 Delete button to remove it.
  5. Adjust the order of the added web actions by clicking Move Up button or Move Down button. Then, when an event that has been bound with more than one action happens, the upper action will be triggered first.
  6. When done , click OK to accept the settings.

For more information about web actions, see Applying Web Actions to a Label.

Binding a link to a parameter field

You can make a parameter field link to 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 links, different targets can be loaded based on different conditions.

To bind a link to a parameter field:

  1. Right-click the parameter field and click Link on the shortcut menu.
  2. In the Insert Link dialog, specify whether it is a conditional link or a simple link, then select the link target and set the options for the link target as required.
  3. When done, click OK.

For details about different link targets, see Binding a Link to a Label.

Adding conditional formats to a parameter field

You can add 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. This is very useful to highlight values that might need to be acted on by the end user.

To add conditional formats to a parameter field:

  1. Right-click the parameter field and select Conditional Formatting from the shortcut menu.
  2. In the Conditional Formatting dialog, click the button Add button to add a condition.
  3. Set the format that will be applied to the field values when the specified condition is fulfilled.
  4. Repeat the above two steps to add more conditions and define the format for each condition.
  5. When done, click OK to save the settings.

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.

BackPrevious Page Next PageNext