To use IBM Cognos product documentation, you must enable JavaScript in your browser.

Highlight Data Using a Conditional Style

Add conditional styles to your report to better identify exceptional or unexpected results. A conditional style is a format, such as cell shading or font color, that is applied to objects if a specified condition is true.

For example, you want to automatically highlight in green the departments in your organization that meet their budget quotas and highlight in red the departments that go over budget. Creating conditional styles color-codes information in your reports so that you can find areas that need attention.

You can apply multiple conditional styles to objects. For example, you can apply one style in specific cells and another style for the overall report. If multiple styles set the same property, such as font color, the last style in the list is applied.

You can apply conditional styles to crosstab cells based on an adjacent value in the crosstab.

You can create a conditional style once and reuse it on multiple objects in your report. You can specify the order in which conditional styles are applied. You can also use existing local classes as your conditional styles.

You can create the following types of conditional styles.

TypeDescription

Numeric Range

Highlights straight numerical data, such as revenues and losses.

Date/Time Range

Highlights data from specific dates and times.

Date Range

Highlights data from specific dates.

Time Range

Highlights data from specific times.

Interval

Highlights data falling between set intervals.

String

Highlights specific alphanumeric items in a report. For example, you can highlight all instances of a specific word or phrase, such as Equipment. String criteria are case-sensitive.

If multiple string conditions are met, only the first conditional style is applied.

Advanced

Creates conditional styles that use calculations or expressions.

If multiple advanced conditions are met, only the first conditional style is applied.

You can perform a search to find objects in your report that use conditional styles . You can also view all the conditional styles used in your report to delete or modify them .

You can also use variables to highlight data . If a report contains both conditional styles and style variables, the style variables are applied first and then the conditional styles are applied.

Tip: The Return Quantity by Order Method sample report in the GO Data Warehouse (analysis) package includes conditional highlighting. For more information about The Great Outdoors Company samples, see Sample Reports and Packages.

Steps to Create a New Conditional Style
  1. Click the object for which you want to define a conditional style and click the conditional styles button .

    Tip: You can also right-click the object and click Style, Conditional Styles or click the object, and then, in the Properties pane, set the Conditional Styles property.

  2. Click the add button  and click New Conditional Style.

  3. Select the data item to determine the condition and click OK.

    Depending on the type of data item you select, Report Studio selects the type of conditional style that you can use.

  4. In the Name box, type a name for the conditional style.

  5. To define a numeric value, date/time, date, time, or interval condition:

  6. To define a string condition:

  7. To apply a conditional style to a crosstab cell based on an adjacent value in the crosstab:

Steps to Reuse an Existing Conditional Style
  1. Click the data item for which you want to define a conditional style, and then click the conditional styles button .

    Tip: You can also right-click the data item and click Style, Conditional Styles or click the data item, and then, in the Properties pane, set the Conditional Styles property.

  2. Click the add button , click Use Existing Conditional Style, and select the style.

Steps to Create an Advanced Conditional Style
  1. Click the data item for which you want to define a conditional style, and then click the conditional styles button .

    Tip: You can also right-click the data item and click Style, Conditional Styles or click the data item, and then, in the Properties pane, set the Conditional Styles property.

  2. Click the add button  and click Advanced Conditional Style.

  3. Type a name for the conditional style.

  4. Click the new button  and specify the expression that defines the condition.

  5. For each condition, under Style, click one of the predefined styles to apply or click the edit style button  and create a new style. Specify the style to apply to remaining values by clicking one of the predefined styles beside Remaining values (including future values).

  6. Specify the order in which to evaluate the conditions by clicking a condition and then clicking the move up or move down arrow.

    Conditions are evaluated from top to bottom, and the first condition that is met is applied.

Manage Conditional Styles

You can view, modify, or delete the conditional styles that are applied to your report. You can also define a new conditional style.

In the Report Studio options, you can specify whether to automatically delete conditional styles that are no longer used in a report .

Step

Example - Add a Conditional Style to an Existing Report

You are a report writer at The Great Outdoors Company, which sells sporting equipment. You have a report that compares current year data to previous year data and highlights negative percentage variances in red (Poor) and positive percentage variances in green (Excellent). You want to add a third conditional style to indicate percentage variances above 0 but less than 10. You create a conditional style that highlights percentage variances between 0 and 10% in yellow (Average).

Steps
  1. Open the GO Balance Sheet as at Dec 31 2006 report from the GO Data Warehouse (analysis) package.

  2. Right-click any cell in the % Variance column and click Style, Conditional Styles.

  3. Select Conditional Style 1 and click the edit button .

  4. Select the first advanced condition listed and click the edit button.

  5. Delete =0 from the expression definition.

  6. Click the Functions tab, and then expand the Operators folder.

  7. Double-click between, and then click after between in the expression, add a space, and type 0.

  8. Double-click and, and then click after and in the expression, add a space, type .1, and click OK.

  9. From the Style box associated with this condition, click Average.

  10. Select the second advanced condition listed and click the edit button.

  11. Replace >0 in the expression with >.1 and click OK.

  12. Leave the style associated with this condition as is.

  13. Run the report.

    The new conditional style appears in the % Variance column.