By Trevor Schulte, IBM Cognos BI Consultant, eCapital Advisors
and Mark Whit, IBM Cognos BI Senior Consultant, eCapital Advisors
As an IBM Cognos BI Consultant, I am often asked if a company can set up a standard report template. While this, on the surface, seems like a generic and trivial task, it is usually imperative for companies to maintain their brand. This blog will identify 3 different template implementations as well as my recommended best practice.
Rather than creating a report template as above, many customers ask that the report template remain a report type. This eliminates the need for converting the report to a template, as well as other users of the template getting a report template file type after they have created a report. However, what if the template changes? Customers may update logos, color schemes, or may just require some rebranding. This solution and the one above are static templates, meaning that once a report is created using the template, each report would need to be changed, should the requirements of the template change. This can be a long, and tedious process for developers as there may be many tens or hundreds of reports.
As in the above two options, the developer would create a report that would, in effect, be a starting point, however they would need another toolbox object in each one of the report areas; a block. By adding a block to the page header and adding the content into the block within the page header, the developer can now name the block “Page Header.” This process can be repeated for page footers, prompt headers, and prompt footers. This allows the developer to reference the specific section when they are implementing the template into their report. This may seem similar to the above solutions, however the layout component reference will allow the headers and footers in previously developed reports to change when the starting point file is changed.
To add another useful step into the mix, authors should create a starting point file for their users. The end result should be a report that acts as an object library and a report that acts as the starting point (with the layout component references already defined). The starting point file can then be used by developers to create reports with a standard, dynamic header and footer.
Example of Template Implementation #3:
I have created a report file called !ObjectLibrary (NOTE: I am using a report file type and not a template because developers cannot add prompt buttons to a template type). This file contains 2 pages; a prompt page and a report page. The prompt page contains a page header and page footer, with each on containing, first a blocked named as such, and then the other elements needed.
The report page follows suit.
Then when I can create my report starting point, I insert a Layout Component Reference into the header of footer section I want to reference. Once the item is dropped, the Component Reference wizard will pop up. Select the radio button next to Another Report, and navigate to the object library report (in my case !ObjectLibrary). Once Open is selected the available components will be available for selecting.
Because I am building the Page Header, I selected the Page Header block. Repeat this process for the Page Footer, and prompt page header and footer, if necessary. It will appear as if it brought in the block and all its content; however it is just a reference object back to the object library report.
The developer is ready to build out the report as usual, using the starting point report as standard template. The major benefit is if the template needs to be changed, it will now change on all the report that use layout component references to the !ObjectLibrary file. This eliminates the developers need to change all the reports previously built on the old template.
By using the Layout Component Reference to build a template (or starting point), we have enabled our business to rebrand reports as needed with increasing developer maintenance time. Below are a couple of additional thought when building a report template.
- Rather than manually typing the name of the report into the header, use the reportName() layout calculation to return the reports name from Cognos. This will allow developers to rename the Cognos report which will automatically change the report name on top of the report layout.
- Secure and/or hide the object library. First and foremost, security can be set to the object library report file. This will help ensure that other users don’t change the objects without permission. Also, the entry can be hidden so that users who may have access to make changes are not distracted by the entry. The hide objects can be shown by changing a user’s My Preferences.
- Buttons on the prompt page may not be good in the footer. I have found that users like having the buttons in the page body. In this instance, I would not include the buttons in the template’s prompt page footer.
- Build a template that contains the objects, and then another report that contain the layout component references to the template report. Now save that as a report starting point. This will give developers a starting point with the layout component references already in place.
IBM Cognos allows developers to create a report template report type. To accomplish this, a user can create a new report, change the headers and footers of both prompt pages and report pages, and then, by going to the File menu, can convert their report to a template. This will allow the user to save the report as a template file type. The benefit is the report template is not saved with package information allowing the template to be used against any data source available to Cognos. Also, this new report template file can be added to the template.xml file which will make the new template available upon Report Studio start up. The drawback is new reports cannot be created directly from the template file. This would be something that could be corrected, however because the report template would still require users to manually update the template.xml file for template changes as well as manually change previously created reports, I won’t explore this option any farther.