When authoring reports in which you have one or more Tree Prompt controls most often you do not present the hierarchy path for specific data sets. This information is not always pertinent and sometimes superfluous. However, offering a hierarchy-based selection of a specific data set for the purpose of constraining data used in a report is at times critical for data validation. In this article I’ll share a practical guide to add breadcrumb trails in Cognos Report Studio. This procedure shows the full hierarchical path of a selection made from a Tree Prompt control, without including it in your main report objects (list, crosstab, graph, visualization). We can accomplish this using a series of Singletons and queries; we will construct the Breadcrumb trail.
Before we get started we need to make sure we start from the same point in our environment.
- The package that includes OLAP data source (DMR, Cube, etc.)
- We have an existing Report Studio report, with at least 1 Tree Prompt (single member selection)
- The number of levels of the hierarchy used for the Tree Prompt has been pre-determined
- Example report is written using the Go Data Warehouse (analysis) package
Ok, it’s time to get started. Below is an outline for making that bread crumb trail for effective reference, and data validation.
Create a Breadcrumb Trail
- Navigate to the Query window using the Query Explorer
- Add a query, and name it “Q_Breadcrumb_Selection”
- Add a data item to the query and name it “Breadcrumb – Selection”
- The expression for the data item should be in the format:
caption(hierarchy -> ?parameter?)
- For each higher level of the hierarchy, add another query and two data items.
- Create a data item named selected_member with the same expression as above except you will remove the caption ( ) portion.
- Use the table below for suggested the query and data names for the higher levels:
Query and Data Item Name
Data Item Expression
|Parent||Breadcrumb_Parent||caption(ancestor([selected_member],1)) + ‘ > ‘|
|Grandparent||Breadcrumb_Grandparent||caption(ancestor([selected_member],2)) + ‘ > ‘|
|Great Grandparent||Breadcrumb_Great_Grandparent||caption(ancestor([selected_member],3)) + ‘ > ‘|
|Great-Great Grandparent||Breadcrumb_Great_Great_Grandparent||caption(ancestor([selected_member],4)) + ‘ > ‘|
You can, of course, use any naming convention that you prefer. Although only suggestions, the names above work well since they accurately describe their role and purpose. The expressions however need to be input as indicated.
- Once you have all created all of the Queries that you need, add a Block to the report where you want to render the Breadcrumb trail.
- In the Source window in the upper-left corner of the Report Studio window, click the Data Items tab.
- Drag in the individual Breadcrumb data items one at a time. Each drag will create a Singleton with the data item contained inside. Repeat until you have all the data items in place, ordered from higher to lower levels, and left to right.
When they have all been inserted into the block, it should resemble something like this:
Now, when the report is executed, you will now see your breadcrumb trail:
Creating your own hierarchy path enables users drill down without getting lost in the data. I hope this article about how to add breadcrumb trails in Cognos assists you in your development efforts. By adding a breadcrumb trail, users can view the full path of where they are in regard to hierarchy and dimension which means more trusted and reliable data.
If you’d like more information on how PMsquare can help you enhance the value of your Cognos solution, reach out to us at Contact@pmsquare.com. Subscribe to our e-newsletter for more technical articles and updates delivered directly to your inbox.