Tel:  +44 (0)2920 02 04 05
e-Mail: info@planitcpm.com

IBM Cognos BI Blog

October 24, 2011

Saving report outputs to file system

Filed under: Business Intelligence — Tags: , , , , , — DBarrett @ 4:40 pm

There are quite a few articles out there detailing how to use the CM.OUTPUTLOCATION parameter to save report outputs to the file system. However, this saves all reports to the location specified in the parameter. What happens if you want to save reports to different locations on a report by report basis?

I recently had to save reports to separate sub-directories based on the report output type e.g. PDF, CSV etc. The instructions below show how this can be achieved.

1. Modify IBM Cognos Configuration

Open Cognos Configuration on the Content Manager Server and expand Data Access>Content Manager. Click Content Manager and then ensure that Save report outputs to a file system? is set to True

From the Actions menu, click Edit Global Configuration, and then click the General tab. Set Archive Location File System Root to the required location. This must be set to either a local path on the server (e.g. file://d:/archive) or a UNC path (e.g. file://\\share\folder) and the location must already exist.

Save the configuration and then restart the Cognos services

2. Modify Cognos Connection

These steps must be performed by an Administrator.

  1. From IBM Cognos Connection, click on Launch (top right)
  2. Click IBM Cognos Administration
  3. Click on Configuration tab
  4. Click Dispatchers and Services (left side)
  5. Click the Define File System Locations button ( top right)

When the Define File System Locations window appears click New

Enter a Name, Description and File System Location. The File System Location specified will be the name of the sub directory created the first time that you select RunWithOptions and save report to new Location.

Although we only added one file system location in this demo, it’s possible to create any number of file system locations. Each new location will relate to a sub directory in the archive location specified in Cognos Configuration

3. Save report to the file system

All of the configuration changes have now been made. Now we can run a report and specify that it is output to the above file system location using the advanced run options:

  1. From Cognos Connection, go into the Run with options of a report
  2. Click Advanced options. Under Delivery check Save to the file System and click on Edit the options…
  3. Select the output location from the drop down menu

Run the report. When this has successfully completed you will notice that the report has been saved to a new sub directory called CSV Files.

September 9, 2011

Conditional drill through

Drill through for individual data items in a crosstab is a really useful feature. However, it’s not always convenient to drill through to the same target report. Although it’s hidden away, it is possible to drill through to a different target report depending on the data item.

The example below shows a scenario where we want to drill through to two different reports based on the year. For the purposes of demonstration, let’s say that all sales in 2004 were postal orders but in subsequent years there are a variety of order methods. To keep things tidy we will drill through to a report that excludes the order method for 2004 and a different report that gives a breakdown of order method in all other years.

I’ve already created two simple list reports for the above scenarios and called them ‘Drill A’ and ‘Drill B’. The latter report includes order method information but the former doesn’t.

Now I want to setup a crosstab that drills through to these reports. In the example below I’ve created a high level summary report showing the revenue by year split out by product line:

 

I want to drill through from the crosstab intersection. Therefore I’m going to click on the unlock button in the toolbar:

 

Next I’ll select the text item in the crosstab intersection:

 

Then click on the drill –through icon in the toolbar:

 

When the drill – through definition window opens we just need to setup the drill through definition to point at one of the target drill reports (in this case ‘Drill A’):

 

Next hold ctrl and drag the text item to the left of itself. This makes an exact copy of the existing text item including the drill through:

 

 

Select the newly created text item and edit the drill definition to point at ‘Drill B’ instead of ‘Drill A’:

 

Now we have two text items that drill through to two different target reports. We need to somehow hide the ‘Drill B’ text item for 2004 and hide the ‘Drill A’ text item for all other years. This is achieved using a Boolean variable (it is also possible to use a string variable).

I’ll create a new Boolean variable where the year is equal to 2004. Being a Boolean variable this gives two possible outcomes. Either ‘Yes’ the year is 2004 or ‘No’ the year is not 2004:

 

By associating both text items with the new variable we can chose to show or hide each text item based on the value of this variable.

Add the Boolean variable as a style variable in the properties of each text item (a render variable would be used for a string variable):

 

Now use the conditional explorer to tell report studio the desired behaviour for each of the results. First select ‘Yes’ (i.e. the year is 2004) and then select the text item associated with ‘Drill B’:

 

Select the text item and then in the properties pane change the box type to ‘none’. This means that when the year is 2004 this text item will not display.

 

Change the conditional explorer to reference ‘No’ (i.e. the year is not 2004). Select the other text item and change the Box Type properties to ‘None’.

 

Now when we run the report only one text item is shown at each intersection. What isn’t entirely obvious is that the text items for 2004 are different to all others:

 

If we click on any of the 2004 items we drill through to ‘Drill A’ which doesn’t include order method information:

If we click on any other cross tab intersection then we drill through to ‘Drill B’ which does include order method information:

 

There you go. Maybe not as straightforward as it ought to be, but definitely a workable solution