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 |
![js-AdHoc-ConditionalView_491x225.png.fce10888d38234552644582bf46b7f82.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 6. | Hover over ![js-AdHoc-icon-SaveReport.png.1a4277953ab9dc237f6cecbd6b4e55ea.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 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 ![js-icon-columnOptions.png.af5dc4a46ab01f155f6959323c966ba9.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 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 ![js-icon-StyleBGUnchanged_24x19.png.6b28fff2c181800f36d73ce2e49d65df.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 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 ![js-icon-StyleBGUnchanged_24x19.png.0304cfa83257d5e6e57f8aa321ab4a12.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 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 ![js-icon-StyleBGUnchanged_24x19.png.4c31e7afec464cca2e39be2efa8b1e5e.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
Conditional Formatting for Numeric Values |
![js-ReportViewer-ConditionalNumeric_495x204.png.c9dacad2862691fb004e6a0ddf2f0a2f.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 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 |
![js-ReportViewer-ConditionalReport_226x177.png.ef564f351ea13d09780aa8442139555c.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
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.