BackPrevious Page Next PageNext

Parameter Fields

Inserting parameter fields in a report

Changing the display type of parameter fields

Binding links to parameter fields

Adding conditional formats to parameter fields

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

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.

Inserting parameter fields 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 page report created using a query resource, 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 parameter fields

JReport Designer provides 13 kinds of display types: Text, Image, Barcode, Rank, Text Field, Hidden Field, Text Area, Checkbox, Radio Button, Image Button, Button, List, and Drop-down List. By changing the display type of a parameter field, you can map the parameter field to other value or image to be displayed instead.

A parameter field in a page report created using query resources can be displayed as one of the following general types: Text, Image, Barcode and Rank. It can also be displayed as a basic web control, including Text Field, Password, Text Area, Checkbox, Radio Button, Image Button, Button, List and Drop-down List. While the parameter fields in a web report or library component can only be displayed as Text.

The Display Type feature is not supported in page reports created using business views.

To edit the display type of a parameter field:

  1. Right-click it and click Display Type on the shortcut menu.
  2. In the Display Type dialog, select the display type you want the parameter field to display in.
  3. If a general display type is selected, take the same procedure as Changing the Display Type of Labels to customize the parameter field.

    If a basic web control type is selected, seeĀ Inserting basic web controls in a page report for details about how to make settings of the display type.

  4. Click OK to accept the changes.

Binding links to parameter fields

You can make the parameter fields in a report link with other reports, locations specified by URLs, e-mail addresses, or Blob data type fields. The links can either be simple links or conditional links. With conditional links, different targets can be loaded based on different conditions.

To bind a link to a parameter field, right-click it and click Link on the shortcut menu, then take the same procedure as described in Binding Links to Labels.

Adding conditional formats to parameter fields

You can add conditional formats to parameter fields in a report, then when a specified condition is fulfilled, the format defined on 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 end users.

To add conditional format to a parameter field, right-click it and select Conditional Formatting from the shortcut menu, then take the same procedure as described in Adding Conditional Formats to DBFields.

BackPrevious Page Next PageNext