Contents


IBM Business Analytics Proven Practices

Display a "No Data Available" message on empty RAVE visualization pages

How to embed a visualization object in a list in Cognos Report Studio

Comments

Content series:

This content is part # of 8 in the series: IBM Business Analytics Proven Practices

Stay tuned for additional content in this series.

This content is part of the series:IBM Business Analytics Proven Practices

Stay tuned for additional content in this series.

In most cases of in-build Cognos objects, the message "No Data Available" is displayed by default when no data is found for the query. You can use the No data contents property to specify a custom message. But for visualization objects, the same default message is not available when a visualization is rendered empty, nor is there a property available to create a custom message. Report pages that contain no data and display a blank visualization can be unappealing and possibly confusing. Was there no data, or did an error occur during rendering?

Because the No data content property to create custom messages is not available for visualization objects, you need to create a workaround to overcome this limitation. One of the ways to display a message on a blank visualization page is to embed it in a list.

This article describes how to avoid blank visualization pages in Cognos reports when no data is available. It also describes how to display informational custom messages. While there are multiple methods from which to choose, this article describes how to embed the visualization object in a list.

Applicability

IBM Cognos version 10.2.2 and higher

Assumptions

Readers are assumed to be IBM Cognos report authors who have experience with IBM Cognos Report Studio 10.2.2.

Creating the sample report

This example describes how to create the Sales namespace in the Sales and marketing (analysis) folder of the GO Data Warehouse (analysis) package.

  1. Import the simple bar chart visualization to the Cognos library by downloading Clustered Bar Default.zip from the IBM Analytics Downloads community.
  2. Open IBM Cognos, and click OK.
  3. Go to the Toolbox tab, and drag the Visualization object to the report page.
  4. When the Visualization Gallery window pops up, select the visualization Bar from the list, and click OK.
    Figure 1. Visualization Gallery showing the Bar chart visualization in the list selected
    Screen capture of Visualization Gallery showing the Bar chart visualization in the list selected
    Screen capture of Visualization Gallery showing the Bar chart visualization in the list selected
  5. Click OK in the Object and Query Names box.
  6. In the Query Explorer, select the visualization query Query 1. Drag Retailer name, Month, and Revenue from the Retailers, Time, and Sales fact dimensions of the Sales namespace in the Sales and Marketing (analysis) folder.
    • [go_data_warehouse].[Sales and Marketing (analysis)].[Sales].[Retailers].[Retailers].[Retailer name]
    • [go_data_warehouse].[Sales and Marketing (analysis)].[Sales].[Sales fact].[Revenue]
    • [go_data_warehouse].[Sales and Marketing (analysis)].[Sales].[Time].[Time].[Month]
    Figure 2. Retailer name, month, and revenue added to Query 1
    Screen capture of Retailer name, month, and revenue added to Query 1
    Screen capture of Retailer name, month, and revenue added to Query 1
  7. From the toolbox, drag a Data Item, and rename it Revenue2. Add the following expression, then click OK:

    if ([Revenue]=0) then (0) else ([Revenue])

  8. From the toolbox, drag Filters to the Detail Filter section. Add the following expression, then click OK:

    [Sales].[Time].[Time].[Month].[Month number] between 13 and 24

  9. From the toolbox, drag Filters to the Detail Filter section. Add the following expression, then click OK:

    [Revenue2] > 250000

  10. In the page explorer, select Page 1, then click the Data Item tab. Place the data items for the visualizations as follows:
    • Drag Revenue2 to the Size box.
    • Drag Retailer name to the Categories box.
    • Drag Month to the Series box.
    Figure 3. Visualization on the report page with data items filled in the container
    Screen capture of Visualization on the report page with data items filled in the container
    Screen capture of Visualization on the report page with data items filled in the container
  11. Run the report. You should see a bar chart like the one in Figure 4.
Figure 4. Report output showing the bar chart for the data items used in the visualization
Screen capture of Report output showing the bar chart for the data items used in the visualization
Screen capture of Report output showing the bar chart for the data items used in the visualization

This is all well and good, but in cases where the query finds no matching records in the database, the visualization is blank. So when the filter [Revenue]=0 is added to the visualization query's Detail Filter section, no matching data is found in the database. The report output displays a blank visualization like that shown in Figure 5.

Figure 5. Report output when there is no data for the visualization to display
Screen capture of Report output when there is no data for the visualization to display
Screen capture of Report output when there is no data for the visualization to display

Embedding the "No Data Available" text in a list

Because the No data content property to create custom messages is not available for visualization objects, you need to create a workaround to overcome this limitation. One of the ways to display a message on a blank visualization page is to embed it in a list by completing the following steps:

  1. From the toolbox, drag List, and assign it to Query 1, which is the basis for the visualization.
  2. From the Data Item tab, drag the Revenue2 data item to the list you just created.
  3. Select List Column Body, and set the Box Type property to None so it will not be shown in the report output.
  4. Unlock the list. Select the visualization, drag it to List Column Title, and place it in the List Header section.
    Figure 6. Box Type property set to None for List Column Body, and visualization object placed inside the List Header section
    Screen capture of Box Type property set to None for List Column Body and visualization object placed inside the List Header section
    Screen capture of Box Type property set to None for List Column Body and visualization object placed inside the List Header section

Now, instead of a blank visualization, the report output will show, by default, "No Data Available" when no data is returned from the query. By selecting the list and using its No Data Contents property, you can specify a custom message to be displayed along with the default "No Data Available" text you created. To create a custom message, complete the following steps:

  1. Select the Content specified in the No data tab option.
  2. Enter the text that you want displayed when no data is returned. In this example, the message "Visualization is empty" is used.
    Figure 7. No Data Contents property to specify custom text
    Screen capture of No Data Contents property to specify custom text
    Screen capture of No Data Contents property to specify custom text

The report will now display "No Data Available" and your custom text when a visualization finds no matching data to display in the database.

Figure 8. Report output showing the default "No Data Available" text as well as the custom text "Visualization is empty"
Screen capture of Report output showing the default No Data                     Available text as well as the custom text Visualization is empty.
Screen capture of Report output showing the default No Data Available text as well as the custom text Visualization is empty.

Conclusion

So there you have it: a workaround you can use to display "No Data Available" messages on empty RAVE visualization pages. There are also other methods to be explored and implemented. The approach described here has the additional advantage of allowing you to incorporate any other property or list, or even add other objects from the toolbar, to make the page more interactive and appealing.


Downloadable resources


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Big data and analytics
ArticleID=1039830
ArticleTitle=IBM Business Analytics Proven Practices: Display a "No Data Available" message on empty RAVE visualization pages
publish-date=12202016