This is the second in a series of articles for the Ironside Cognos Report Studio Cookbook. The first article can be viewed here. These are tips and tricks used by our professional report developers to meet the unique needs and requirements of our clients. While some of these techniques may be touched upon in a typical Report Studio training class, we will take a deep dive into these concepts to uncover how our professionals actually use them in the field every day.

Difficulty: Easy

Required Ingredients: String variable, value prompt, text item, parameter

Scenario

You have an interactive HTML report with an in-report prompt for year. Since the year is not displayed anywhere else in the report, the prompt also serves as a contextual label. However, the users would also like to be able to export to PDF. The problem with that is the value prompt is only visible in interactive HTML. Once the report is rendered in PDF or Excel, the year selected will not be known to the consumer of the report output (as illustrated below).

Scenario

There are several methods to solve this problem, but we’re going to concentrate on the use of a built-in Cognos function and the Render Variable.

 

In the example below, we open a simple report in Report Studio that contains a value prompt for Year.

Annual Product Sales by Region

Step 1: From the Toolbox, drag a Text Item next to the Value Prompt.

Value Prompt

 

Step 2: In the text editor, type in Year label and click OK.

OK

 

Step 3: While still on Text Item, locate the Source Type property and select Report Expression. Click the ellipsis next to the Report Expression property.

Report Expression

Step 4: In the Report Expression editor, click on the Parameters tab and drag p_Year into the Expression Definition box and click OK.

Expression Definition

 

Step 5: While still on the Text Item, locate the Render Variable property and click on the ellipsis.

Render Variable

 

Step 6: In the Variable dropdown, select <New string variable>.

New String Variable

 

Step 7: In the New Variable dialog box name field, type vReportOutput. Then click on the New icon.

Report Output

 

Step 8: In the Add dialog box, type PDF. Click OK.

PDF

 

 

Step 9: Click OK on the New Variable dialog box.

New Variable

Step 10: In the Report Expression editor, click on the Functions tab, expand Report Functions, and locate the function named ReportOutput(). Drag ReportOutput() into the Expression Definition box and click OK.

Report Expression

 

Step 11: Make sure PDF is checked and click OK.

PDF

 

Step 12: Run the report in both HTML and PDF. Notice the Year label text only shows up in the PDF report output.

Products by Region

 

Other Applications

This same technique can be used in multiple objects within reports (basically any object that has a Render Variable property). For example, the Table of Contents object in the Toolbox only renders in PDF output, thus an entire report page object could be included or excluded based on report output.

 

1 reply

Trackbacks & Pingbacks

  1. […] with our Report Studio Cookbook series, today we will look at the new Report Studio JavaScript prompt API available in IBM Cognos 10.2. […]

Comments are closed.