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

Adding Conditional Rendering to a Report

You can specify which objects are rendered when a report is run. You can

Add a Variable

Before you can add conditional formatting or conditional rendering to your report, you must add a variable. You can create a variable in the condition explorer or in the Properties pane.

Steps to Add a Variable from the Condition Explorer
  1. Pause the pointer over the condition explorer button  and click Variables.

  2. In the Insertable Objects pane, drag one of the following variables to the Variables pane:

  3. If you created a boolean variable, in the Expression Definition box, define the condition and click OK.

    For example, the following expression returns the value Yes if revenue is less than one million and the value No if revenue is greater than or equal to one million:

    [Revenue]<1000000

    For information about creating expressions, see Using the Expression Editor.

  4. If you created a string variable, do the following:

  5. If you created a language-specific variable, in the Languages dialog box, select the languages to support.

Steps to Add a Variable from the Properties Pane
  1. Select the report object.

  2. In the Properties pane, under Conditional, double-click the conditional property to which to assign the variable.

    The following conditional properties are available:

    Goal

    Conditional Property

    Specify a variable based on which text can be conditionally shown.

    For example, you want different text to appear when a report is run in a different language.

    Text Source Variable

    Specify a variable based on which object can be conditionally rendered.

    For example, you want to make a revenue report smaller by not rendering rows that are below a threshold.

    Render Variable

    Specify a variable based on which object can be conditionally styled.

    For example, you want data that meets some criterion to appear in a different color.

    Style Variable

    Specify a variable based on which objects in a block can be conditionally rendered. Applies only to conditional block objects that you insert in a report .

    Block Variable

  3. In the Variable box, click an existing variable or one of the following variable types:

  4. In the New Variable dialog box, in the Name box, type the name of the variable.

  5. If you created a string variable, click the add button , type the string values to define, and click OK.

  6. If you created a language variable, select the languages to support and click OK.

  7. In the Expression Definition box, define the condition.

Hide or Show an Object

You can hide and show objects in a report based on a condition you define.

You can also specify that an object should not be rendered based on a condition .

Tip: The Global Bonus Report sample report in the GO Data Warehouse (analysis) package includes hidden objects. For more information about The Great Outdoors Company samples, see Sample Reports and Packages.

Steps
  1. Create a variable, and define the condition that determines if the object is shown or hidden.

    Tip: Create a boolean variable to show and hide objects, as this type of variable has only two possible values.

  2. In the Insertable Objects pane, on the Toolbox tab , drag a Conditional Blocks object to the work area.

  3. Select the conditional block.

  4. In the Properties pane, double-click the Block Variable property.

  5. In the Variable box, click the variable you created and click OK.

  6. Set the Current Block property to Yes.

  7. In the Insertable Objects pane, drag the object to show or hide to the conditional block.

    For example, drag a data item from the Source tab or from the Data Items tab.

    You may need to link the report page to a query before you can add a data item to the block.

When you run the report, the report objects to which you applied the variable are visible when the condition is satisfied and invisible when it is not.

Add Conditional Rendering

Add conditional rendering to specify which objects are rendered when a report is run. This is useful when your report contains sensitive data.

Conditional rendering is not the same as hiding objects. When you hide an object, the object exists but is transparent. If an object is not rendered, it is not in the report.

For a list of objects that can be rendered conditionally, see the Render Variable property in Report Studio Object and Property Reference.

Steps
  1. Select the list column to be rendered conditionally.

    Tip: You must select the list column, not the list column body or the list column title. If the body or title is selected, as indicated in the Properties pane, click the select ancestor button  and click the list column.

  2. In the Properties pane, double-click the Render Variable property.

  3. Click Variable and click the variable that will determine if the column will be rendered.

  4. In the Render for box, select the values that the condition will support.

    Tip: A default value exists for the variable, and it is always selected.

Example - Create a Conditional Report

You are a report author at The Great Outdoors Company, which sells sporting equipment. You are requested to create a report that shows orders after a date specified by the user. The report will prompt the user for a date and ask whether the user wants to see a description for each order.

Steps to Create a Report
  1. Open Report Studio with the GO Data Warehouse (query) package.

  2. In the Welcome dialog box, click Create a new report or template.

  3. In the New dialog box, click List and click OK.

  4. In the Insertable Objects pane, on the Source tab , expand Sales and Marketing (query), and Sales (query) and add data items to the list:

  5. Click Date, and then click the section button .

  6. Select the Order Number column and click the group button .

  7. Click Revenue, and then click the aggregate button  and click Total.

  8. Change the title of the report to New Orders.

  9. Pause the pointer over the page explorer button  and click Prompt Pages.

  10. Create a new prompt page by double-clicking Page in the Insertable Objects pane.

  11. Double-click the new prompt page.

  12. In the Insertable Objects pane, on the Toolbox tab , double-click Text Item and type the following text:

    Enter the start date, and select if descriptions will be shown.

  13. Insert a 2 by 2 table into the prompt page by clicking the insert table button  and moving the pointer until four squares are highlighted in a 2 by 2 pattern.

  14. In the Insertable Objects pane, on the Toolbox tab, drag a Text Item into the upper-left cell and type the following text:

    Starting Date

  15. In the Insertable Objects pane, drag a Text Item into the lower-left cell and type the following text:

    Show Descriptions

  16. In the Insertable Objects pane, drag a Date Prompt into the upper-right cell.

  17. In the Prompt Wizard window, select Create a new parameter, type p_Date in the space provided, and then click Next.

  18. In the Create Filter window, select Create a parameterized filter with the following entries:

  19. Click Finish.

  20. In the Insertable Objects pane, drag a Value Prompt into the lower-right cell.

  21. In the Prompt Wizard, in the Choose Parameter window, select Create a new parameter, type p_ShowDesc in the space provided, and then click Finish.

  22. Select the Value Prompt and, in the Properties pane, double-click Static Choices.

  23. Click the add button .

  24. In the Edit dialog box, type Yes in both the Use and Display boxes.

  25. Click the add button.

  26. In the Edit dialog box, type No in both the Use and Display boxes.

  27. Click OK.

Steps to Add Conditions
  1. Pause the pointer over the condition explorer button  and click Variables.

  2. In the Insertable Objects pane, create a new boolean variable by double-clicking Boolean Variable.

  3. In the Report Expression dialog box, type the following in the Expression Definition window and click OK:

    ParamDisplayValue("p_ShowDesc") = 'Yes'

  4. In the Properties pane, set the Name property to showDesc.

  5. Pause the pointer over the page explorer button  and click the report page.

  6. Click the Product descriptions column.

  7. In the Properties pane, click the select ancestor button  and click List Column.

  8. In the Properties pane, set the Render Variable property to the showDesc boolean variable you created.

  9. Run the report.

The report prompts you for a date provides orders that occur after the date you entered. The report also asks whether to show the Descriptions column, and the column is rendered only if you choose Yes.

Add Multiple Layouts

Add multiple layouts to show a report in different ways. For example, you can define a different layout for each language in a multilingual report. This allows you to create a single report that can be viewed by report consumers that use different regional settings.

Steps
  1. Create a variable and define the condition that will be used for each layout.

    For example, create a report language variable that includes each language that requires a conditional layout.

    Note: Expressions used in a conditional layout cannot reference a query.

  2. From the File menu, click Conditional Layouts.

  3. Select a variable, and then select the values that require a separate layout.

A layout is created for each value you selected. Use the page explorer to navigate the different layouts. For each layout, click Report Pages to create a report page or Prompt Pages to create a prompt page and add objects.

Tip: You can create new variables from the Conditional Layouts dialog. The variables are added to the condition explorer. For more information, see Add a Variable.

Creating Multilingual Reports

You can create reports that show data in more than one language and use different regional settings. This means that you can create a single report that can be used by report consumers anywhere in the world.

The samples databases provided with IBM Cognos 8 store a selection of text fields, such as names and descriptions, in more than 25 languages to demonstrate a multilingual reporting environment. For information about how data is stored in the samples databases and how the samples databases are set up to use multilingual data, see the Administration and Security Guide.

Here is the process for creating a multilingual reporting environment:

      

Use multilingual metadata.

The data source administrator can store multilingual data in either individual tables, rows, or columns.

For more information about configuring your database for multilingual reporting, see the Administration and Security Guide.

      

Create a multilingual model.

Modelers use Framework Manager to add multilingual metadata to the model from any data source type except OLAP. They add multilingual metadata by defining which languages the model supports, translating text strings in the model for things such as object names and descriptions, and defining which languages are exported in each package. If the data source contains multilingual data, modelers can define queries that retrieve data in the default language for the report user.

For more information, see the Framework Manager User Guide.

      

Create multilingual maps.

Administrators and modelers use a Windows utility named Map Manager to import maps and update labels for maps in Report Studio. For map features such as country and city names, administrators and modelers can define alternative names to provide multilingual versions of text that appears on the map.

For more information, see the Map Manager Installation and User Guide.

      

Create a multilingual report.

The report author uses Report Studio to create a report that can be viewed in different languages. For example, you can specify that text, such as the title, appears in German when the report is opened by a German user. You can also add translations for text objects, and create other language-dependent objects.

For more information, see the Report Studio Professional Authoring User Guide.

      

Specify the language in which a report is viewed.

You can use IBM Cognos Connection to do the following:

  • Define multilingual properties, such as a name, screen tip, and description, for each entry in the portal.

  • Specify the default language to be used when a report is run.

    Tip: You can specify the default language on the run options page, in the report properties, or in your preferences.

  • Specify a language, other than the default, to be used when a report is run.

For more information, see the IBM Cognos Connection User Guide.

The data then appears in the language and with the regional settings specified in

Any text that users or authors add appears in the language in which they typed it.

Create a Multilingual Report in Report Studio

You can create a report in Report Studio that can be viewed in different languages. For example, you can specify that text such as the title appears in German when the report is opened by a German user. You can also add translations for text objects and create other language-dependent objects.

If you want the report to show data in different languages, the model must also be multilingual.

Steps
  1. Create a report language variable.

  2. In the work area, select the object to modify based on a language.

  3. In the Properties pane, double-click the Style Variable property.

    If you are changing the language of a text string, click Text Source Variable instead.

  4. Click Variable and click the language variable you created.

  5. In the Values box, select the languages for the condition to support and click OK.

    Tip: A default value exists for the variable, and it is always selected.

  6. Pause the pointer over the condition explorer button  and a language for the variable.

    Tip: When you select a value in the condition explorer, the Explorer bar becomes green to indicate that conditional formatting is turned on and that any changes you make to the report apply only to the variable value.

  7. In the Properties pane, specify the formatting for the language.

    For example, to change the language of a text string, double-click the Text property and select the new string.

  8. Press Enter when you are done.

  9. Repeat steps 6 to 8 for all other languages specified for the variable.

    Tip: To view the report with no variables applied, pause the pointer over the condition explorer button and click (No variable) or triple-click the Explorer bar.

When you run the report, the report objects to which you applied the variable are formatted according to the browser's language.