BackPrevious Page Next PageNext

Formula Fields

Inserting formula fields in a report

Changing the display type of formula fields

Binding links to formula fields

Adding conditional formats to formula fields

Formulas are calculated from DBFields, other formulas, summaries, and parameters, so they can present information that DBFields cannot do.

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 formula field example, open <install_root>\Demo\Reports\SampleComponents\UsingFormula.cls.

Inserting formula fields in a report

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

Notes:

Changing the display type of formula 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 formula field, you can map the formula field to other value or image to be displayed instead.

A formula 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, and Button. While the formula 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 formula 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 formula 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 formula 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 formula fields

You can make the formula 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 formula 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 formula fields

You can add conditional formats to formula 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 formula 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