Report Variables

Most conditional processing is based on report variables. There are three types of report variables: string, boolean and locale.

The variable to test is specified by the refVariable attribute. The test condition is specified by the refVariableValue attribute.These attributes are available on most of the conditional elements.

Some typical tasks you may want to do using report variables are as follows.

  • Support multiple locales by using different report layouts or displays for each language.
  • Decide whether to render or not render report results depending on the sensitivity of the data.
  • Add conditional formatting to highlight specific report results.

Note: Although you can use report variables to apply conditional formatting, we recommend using the namedConditionalStyles element and its child elements. For more information, see Conditional Formatting.

The main report specification objects that are used to define report variables or use report variables are as follows.

Table 1. Report specification objects used to define report variables
Report Specification Objects Used to
reportVariable element Define a string, Boolean or locale report variable.
refVariable attribute Specify the report variable to test for conditional processing.
refVariableValue attribute Specify the test condition.
conditionalDataSource element Contain the data source to return based on a report variable.
conditionalChartColor element Specify a color, color gradient, or pattern to apply to a portion of the chart if a certain condition is true.
conditionalBlock element Contain a set of layout elements to render based on a report variable.
conditionalDisplayValue element Specify the display value to use, conditionally based on the refVariable attribute of the selectOptions element.
conditionalRender element Render the parent layout element based on the evaluation of a report variable.
conditionalLayout element Render a report with different layouts based on the evaluation of a report variable.

For more information about the use of report variables and conditional processing, see the IBM® Cognos® Analytics - Reporting User Guide.