IBM Support

Conditionally display one list or another based on a prompt

Technote (troubleshooting)


How to conditionally display either List-A or List-B based on a value prompt. This technique can be applied to examples such as displaying either a chart or a crosstab, or displaying a detailed list or summary list. This particular prompt is a boolean prompt, therefore only has 2 choices. Expanding this example to a string variable can allow a report to be displayed as either list, chart or crosstab based on the prompt.

Resolving the problem

Use conditional block lists to display one report layout or another based on the boolean parameter that is used in the value prompt.

Steps:The report contains 2 list reports. The prompt controls which list to display. A conditional block list is used in the report specification.

1. Create a list report.
2. Add a second list to the report layout based on the first query.
3. Modify the second list to display the information you want.
4. Go into the tabular model of the query and add a data item.
5. In the definition of the new data item type in the following: ?DisplayOption?
6. Create an empty prompt page.
7. Add a value prompt to the prompt page.
8. In the value prompt properties, add static choices.
9. The use values are the ones that you are going to be comparing to in your conditional variable, the display values are the ones that are displayed on the actual prompt when running the report. Take a look at the attached report specification to see an example. Note that since I have 2 choices in my static choices, I will choose to use a boolean as my conditional variable.
10. Go back to the page layout.
11. Add a conditional block list to the report.
12. In the conditional block properties, double click Conditional Block.
13. Click Variables to create a new variable.
14. Add a new variable.
15. Give the variable a name and select boolean as the type.
16. In the expression, refer to the resulting text of the parameter. Refer to step 9 where you entered in the static choices. The ParamDisplayValue should equal to the use text of the static choice.

ParamDisplayValue("DisplayOption")="Product Line & Name"

17. Ensure that the conditional block list is selected.
18. In the properties of the conditional block, look for Current Block, that is the switch that toggles between the two lists.
19. Ensure that Yes is select, that will refer to the Yes conditional of whether your variable is fulfilled or not.
20. Drag the corresponding list into the conditional block.
21. Change the Current Block value to No.
22. Drag the other list into the conditional block.

Now you can run the report. Based on the value prompt selection, the corresponding list will display.

Cross Reference information
Segment Product Component Platform Version Edition
Business Analytics Cognos 8 Business Intelligence Install and Config
Business Analytics Cognos 8 Business Intelligence Report Studio
Business Analytics Cognos ReportNet ReportNet

Historical Number


Document information

More support for: Cognos 8 Business Intelligence
Report Studio

Software version: 1.1, 8.1, 8.2

Operating system(s): AIX, Windows

Reference #: 1339350

Modified date: 14 October 2008