| This section describes functionality that can be restricted by the software license for JasperReports Server. If you don’t see some of the options described in this section, your license may prohibit you from using them. To find out what you're licensed to use, or to upgrade your license, contact Jaspersoft. |
The interactive Report Viewer lets you highlight table values using conditional formatting. This section shows how to use multiple conditions in a table to create a stoplight format based on ranges. To set up this format, you need to use the inheritance feature of conditional formatting. For colored backgrounds, this specifies that when a table cell satisfies multiple conditions, the condition that appears highest in the list of conditions is applied.
To create the Ad Hoc table for use in the example:
| 1. | Select Create > Ad Hoc View from the menu. The Data Chooser wizard opens. |
| 2. | Click Domains, select SuperMart Domain, and click Choose Data. The Data Chooser opens to the Select Fields page. |
| 3. | In the Source panel, double-click Sales to move it to the Selected Fields panel. |
| 4. | Click Table. The Ad Hoc Editor is displayed with the selected fields. |
| 5. | Double-click the following fields and measures to add them to the Columns area: Product Name, Recyclable Packaging, Store Sales. The Ad Hoc view appears as shown in the following figure. |
Ad Hoc View for Conditional Text |
|
| 6. | Hover over |
| 7. | Fill in the required fields as follows: |
| a. | Data View Name: Conditional Text Example View |
| b. | Data View Description: Created in Ultimate Guide |
| c. | Report Name: Conditional Text Example Report |
| d. | Report Description: Created in Ultimate Guide |
| 8. | For Save Location, click Browse, select Public > Samples > Reports, and click OK. |
| 9. | Click Save. A message confirms that the view was saved. |
To open the report in the viewer:
| 1. | Select View > Repository. |
| 2. | Navigate to Public > Samples > Reports and click Conditional Text Example Report. The report opens in the interactive report viewer. |
To create “stop light” conditional formatting on a numeric column:
| 1. | Click the Store Sales column. The column is highlighted and the column formatting icons appear at the top of the column. |
| 2. | Move your mouse over |
| 3. | Click the Conditional Formatting tab. The Conditional Formatting options appear. |
| 4. | Click Add to create a new condition, and fill in the fields as follows: |
| a. | Select Greater than from the Operator menu. |
| b. | Enter 8 in the Condition box. |
| c. | Click |
| 5. | Click Add to create a second condition, and fill in the fields as follows: |
| a. | Select Greater than from the Operator menu. |
| b. | Enter 3.5 in the Condition box. |
| c. | Click |
| 6. | Click Add to create a new condition, and fill in the fields as follows: |
| a. | Select Less than or equal to from the Operator menu. |
| b. | Enter 3.5 in the Condition box. |
| c. | Click |
Conditional Formatting for Numeric Values |
|
| 7. | Click OK. The dialog box closes and your choices are applied. The report appears as shown in the following figure: |
Report with Conditional Formatting |
|
Notice that numbers greater than 8 satisfy the first two conditions; the first condition they satisfy is the one that is applied.
Recommended Comments
There are no comments to display.