View Table or Chart with prompt

In report you often want to switch between a crosstab/table or a chart. You can give the user this selection with a prompt and a variable.

1. Insert a value prompt above the table. Parameter is p_view

2. Insert static choises:

Use      View

Table   Table

Chart   Chart

3. Set standard selection to the type you want to see default, eg. Chart

4. Create a variable “VarView” with the expression: If (ParamValue(‘p_view’) = ‘Table’) then ‘Table’ else ‘Chart’

5. Add values to the variable: Table, Chart

6. Make sure that the crosstab/table is placed in a table. Also the chart has to be placed in a table.

7. Click once on the table cell the crosstab/table is placed in

8. Choose Stylevariable = “VarView”

9. Click once an the table cell the chart is placed in

10. Choose Stylevariable = “VarView”

11. Now select the value “table” from the variable, the centre gets green

12. Select the tablecell where the chart is placed and set “box type” to “none”

13. Now select the value “chart” from the variable

14. Select the tablecell where the crosstab/table is placed and set “box type” to “none”

15. Add some script with a html item next to the value prompt to hide the first 2 lines.

      See the article Hide 2 top rows in prompt on this site

Mini Chart in crosstab row


You want to display a mini chart in the row of a crosstab.


Create a crosstab report with for example: Product-line, year and sales.

Go to the Query Explorer and rename Query1 to Crosstab.

Go to the Query Explorer and copy the Crosstab query. Then click paste and rename the query to Chart.

Create a line chart with the query Chart as source. Add year-month from the date dimension into the query.

From the query drag year-month into the X-axis Catagory. Then drag Sales into Y-axis Default measure.

Define a sort on the X-axis. Select the abc on the X-axis, go to the properties and choose NO for Visible. Select the Y-axis and go to the properties and choose NO for Visible. In the properties of the Chart set Hide for Legend.

Set the size of the graph to 70px (height) and 140px (width) in the Size&Overflow properties of the Chart.

Unlock all objects in the report.

Drag a table into the row with the productlines in the crosstab (1 row, 2 columns).

Drag and drop Product-line into the table. Choose align left for that field of the table.

Now drag the chart into the left field of the table.

Go to the properties of the chart and click on Master Detail Relationships. A propertie box opens. In here create a new link between Product-line from the Query Crosstab and Product-line from the query Chart.

Now run the report to see the result.

Custom Chart Palettes

Some Companies want to have a special set of colors when they use charts in a report.

Underneath an example of two charts. One with default colors an the other with custom colors.

custom_chart_color_6 custom_chart_color_5



This can be achived by editing 2 system XML files.

It is to be recommended to save the original files so you wil be able to return to the original configuration.

The article describes the process by which you can add new chart palettes or customize existing chart palettes for use in IBM Cognos 8 Report Studio.

Click on the following link to open the PDF: