BackPrevious Page Next PageNext

Special Fields

Special fields supported by JReport

Referencing special fields in a formula

Inserting a special field into a report

Changing the display type of a special field

Applying web actions to a special field

Binding a link to a special field

Adding conditional formats to a special field

Special fields supported by JReport

Special fields are defined by JReport and allow you to easily obtain system information and report-related data and add it to your report. The special fields are as follows:

Date-time

Lists all the datetime type special fields.

Computed

Lists all the special fields that are computed based on the report.

System

Lists all the special fields which get values from the system.

Notes:

Inserting a special field into a report

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

To insert a special field into a report:

  1. Position the mouse pointer at the destination where the special field is to be inserted.
  2. Click Insert > Special Fields or Home > Insert > Special Fields, and select the required field from the drop-down menu.

Referencing special fields in a formula

Some special fields can be used in formulas. They are User Name, Print Date, Print Time, Fetch Date, Fetch Time, Modified Date, Modified Time, Record Number, Page Number, Global Page Number, Total Records and Total Fetched Records. They can all be divided into two types (page level and constant level) according to the time when their values are ready.

Page level

The value of this special field is ready at the time when the report result is generated. A formula which references a page-level special field is treated as a page-level formula. In which, the formula is calculated more than once.

The special fields of this type are: Fetch Date, Fetch Time, Print Date, Print Time, Record Number, Page Number, Global Page Number, Total Records and Total Fetched Records.

Constant level

The value of this special field is ready at any time before the engine runs. A formula which references a constant-level special field is treated as a constant-level formula, and is calculated only once.

The special fields of this type are: User Name, Modified Date and Modified Time.

Changing the display type of a special field

The display type of a special field can be changed, that is to say, you can map the special field to another value or image to be displayed instead.

To change the display type a special field:

  1. Right-click the special 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 in the Web Options panel.
  3. Upon finishing, click the OK button to close the dialog.

For details about display types, see Changing the Display Type of a Label.

Applying web actions to a special field

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

To apply web actions to a special field:

  1. Right-click the special 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 Chosse 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 Remove button to remove it.
  5. Adjust the order of the added web actions by clicking Mmove 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 special field

You can make a special 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 special field:

  1. Right-click the special 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 special field

You can add conditional formats to a special field, then when a specified condition is fulfilled, the format bound with the condition will be applied to the field values automatically. However, conditional formatting applies only to the two special fields: Page Number and User Name.

To add conditional formats to the special field Page Number/User Name:

  1. Right-click the special 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 special field example, open <install_root>\Demo\Reports\SampleComponents\ForSpecialFields.cls.

BackPrevious Page Next PageNext