In all organizations, the reporting suite is required to follow the standard formatting. Similar to other tools and technologies, Cognos Report Studio also allows you to create and use templates in order to maintain the standards, reduce cosmetic errors, and save time.
Notice that the Model/Source pane becomes empty and all data items are removed from the report.
<report>
tag, remove the xmlns
and template
attributes. So it should look like this: <report
expressionLocale="en-gb">
<template name="PACKT
Sample
Template">
</template>
at the end of the file. (Just after </report>
)C8_location/webcontent/pat/res/templates.xml
file.templates.xml
file. Paste the specification that we copied in step 4, under <xmlFragment
id="ReportTemplates">
tag. Save the file and close it.Resources.xml
file. Locate c8_location/webcontent/pat/res/Resources.xml
and open in XML editor.<listItems>
tag. Add following line in similar fashion as the existing <listItem>
tags.<listItem label="PACKT Template" icon="icon_blank.gif" templateName="PACKT Sample Template"/>
Select this option and check that the template we created initially appears.
Now you can create a new report as usual. You are rest assured that formatting of objects and other components that you placed on the templates are maintained every time you create a new report using this.
This recipe looks like a long process but it is a one-time task which is extremely useful. We have already discussed the advantage of having templates.
If you are going to create many reports that need organization standards formatting, some common scripts and components, and generic header and footer elements—it is highly recommended that you take time to prepare a template for it.
It is common to see a Cognos developer opening one existing report, making a copy of it and then updating it—thus using the base report as template. While this serves the purpose very well, there are chances of accidently overwriting the templates. Especially in the case of multi-developer environment, it is suggested that one who has access to server installations performs this operation of defining standard template and rest of the team uses it from New Report dialog box.