Cognos BI Best Practices
Cognos BI Best Practices
Cognos BI Best Practices
1 of 19
COGNOS – Best Programming Practices
1.0 Introduction
2.0 Purpose
Cognos Configuration
Framework Manager
Cognos Connection
Query Studio
Report Studio
2 of 19
COGNOS – Best Programming Practices
Analysis Studio
The default installation configures Cognos 8 gateway server to use CGI gateway.
But CGI gateway delivers the slowest performance. Performance can be
improved by configuring Cognos to use gateways like: ISAPI – delivers fastest
performance when used with Microsoft IIS Webserver, Apache_mod – this
gateway can be used with Apache web severs or IBM HTTP servers, Servlet – to
use servlet gateway if the webserver infrastructure supports servlets.
While creating the Database take care of the Collation sequence to be Case
Insensitive.
Create an installation and configuration with the following Servers.
o Server 1 having the Web Server and the Gateway components
o Server 2 Application server (also called Dispatcher server)
o Server 3 Content Manager
o Server 4 Content Store
The number of Gateway servers and Dispatcher servers can be increased based
on the number of users; a large number of simultaneous users require more than
one gateway and dispatcher server to handle the load.
The content manager is imperative if many users are expected to use the Cognos
servers in a given timeframe.
3 of 19
COGNOS – Best Programming Practices
Configure the email option and test for emailing if required. Use the notification
option in the Configuration> Data Access.
While configuring Audit reports and Audit database, set audit level to report for a
balanced performance. Setting the audit level to a level below this will result in
very less data capture in the Audit database. Setting the level higher than the
third will result in a decrease in performance due to frequent data entry in the
audit database.
For backup and disaster management, a backup of the content store on a regular
basis will ensure minimal loss of reports and data in the case of a content store
crash.
Framework Manager runs in Microsoft Windows and provides GUI for metadata
modeling and package creation. It provides users with options to import metadata
from one or more data sources/excel files/MOLAP cubes etc and transform it into a
business-oriented model that can be used to create reports and for Ad-hoc analysis.
When you work in Framework Manager, you work in a Project. A project contains
namespaces, query subjects, folders, and packages.
After you define a Framework Manager Project along with model you can publish
the package containing the metadata information to the Content manager server
for use by authors and query users.
After a package is published to the Cognos server, report authors can use the model
to create dashboards, reports and ad-hoc queries.
The basic structure we recommend is a 3-layer model with data source and stored
procedure query subjects with relationships defined providing a physical query layer;
model based query subjects, shortcuts of other data source query subjects and
stored procedure query subjects, complex calculations forming the staging layer and
rearranged business level query subjects providing the presentation layer.
4 of 19
COGNOS – Best Programming Practices
The 3--layer model works well for both report authors and data modelers. The
presentation layer makes it easier for report authors to find and understand their
data, while the physical layer acts as the foundation for the presentation layer.
In the absence of complex model based query subjects and calculations, a 2-layer
model is recommended.
This organization of information into relevant business categories simplifies the user
reporting experience as users can locate the information they require more easily.
Query items have had default data formatting specified.
Underlying this presentation layer is a series of data source query subjects that,
while not visible to the report author, define the very essence of the model
including:
Basic data access – SQL queries define the views into the query database
Calculations – so that each user does not have to perform the same basic
business Calculations in each report or query
Multilingual data access – the sample databases are in 26 languages. Each user
sees only the data for the language they request. ReportNet is able to do this
automatically based on the fashion in which the SQL queries are modified at run
time according to the rules laid out by the Framework Manager modeler.
All objects in a project have an identifier that is used to reference them. The
identifier can consist of one, two, or three parts, depending upon the type of object.
The parts include
If you want to have objects with the same name in a project, these objects need a
unique identifier. To create a unique identifier for an object, you must create a
namespace.
5 of 19
COGNOS – Best Programming Practices
Some objects in a project have a one-part identifier. The one-part identifier must be
unique across the entire project, even if the namespace contains other namespaces.
These are the objects that have a one-part identifier:
Namespaces
Functions
Shortcuts to namespaces
Shortcuts to folders
Most of the objects in a Framework Manager project have a two-part identifier. The
two-part identifier consists of the name of the containing namespace and the name
of the object. The object name must be unique in the nearest containing namespace.
For example, you have a Sonata namespace that contains a query subject named
Verticals. The Verticals query subject has the following name, where the square
brackets and periods are the syntax Framework Manager uses for object identifiers.
[Sonata]. [Verticals]
Query items
For example, you have a Sonata namespace that contains a query subject named
Verticals, and a query item named Finance. The Finance query item has the following
name, where the square brackets and periods are the syntax Framework Manager
uses for object identifiers.
When you are preparing metadata for use in a reporting application, you must
identify the relationships and aggregations that are necessary to generate efficient
queries that deliver the required results.
6 of 19
COGNOS – Best Programming Practices
Before report authors can create reports, you must follow a process in Framework
Manager:
Ensure that you know your data and the structure of your data source(s).
You should import only the smallest number of tables and relationships that
you need in your project.
o Shortcuts in the same folder as the target query subject use the
relationships of the target query subject.
Use star schema groups to isolate fact tables that share conformed
dimension(s). By using shortcuts to separate fact tables into different
folders, you can resolve any ambiguous relationships.
7 of 19
COGNOS – Best Programming Practices
layer.
o Where ever possible, use shortcuts rather than copies. This helps
you maintain the objects by ensuring that changes to the target
object are reflected in the shortcut.
o Plan your filters carefully so that you can reuse them with multiple
query subjects.
Minimize the use of hardcoded hand typed SQL. The use of hardcoded SQL
instead of importing tables form the database makes maintenance and
enhancements difficult. Any change in the database table structure will
necessitate analysis, change and testing of every hard-coded SQL. Instead of
this, if objects are imported from the database, changes in table structure
can be verified in the first layer only with minimal effort.
Avoid fact to fact joins by creating separate star schema groupings. Fact to
Fact joins lead to bad performance of reports.
Cognos Connection is the Web portal for Cognos 8 BI. Use the portal to store and
access your reports. If you have the necessary permissions, you can also use the
portal for report administration, including scheduling and distributing reports;
server administration and content administration. Administrators use the portal to
administer servers, optimize performance, and set access permissions.
1. In the portal, locate the entry for which you want to set access permissions.
2. In the Actions column, click the Set properties button for the entry.
8 of 19
COGNOS – Best Programming Practices
4. Choose whether to use the permissions of the parent entry or specify different
permissions (For easier maintenance, it is recommended that security be set in the
parent level where ever possible):
To use the permissions of the parent entry, clear the Override the access
Permissions acquired from the parent entry check box, and then proceed to
step 11.
To set access permissions explicitly for the entry, select the Override the
access Permissions acquired from the parent entry check box, and then
perform the remaining steps.
5. If you want to remove an entry from the list, select its check box and click
Remove.
6. If you want to select or deselect all entries in a page, click Select all or Deselect all
at the bottom of the list.
7. To specify the entries for which you want to grant or deny access to this entry,
click Add and then choose a method:
To add entries by selecting the names from the list, on the Navigate tab,
click the appropriate namespace, and then select the check boxes next to
the users, groups, or roles, and click Add. When the entries appear in the
Entries to be added box, click OK.
To search for users, groups, or roles in a namespace you are currently using,
on the Search tab, type the text in the Search string box. If needed, specify
additional search criteria, and click Search. When the entry appears in the
Search results box, click Add, and then, when the entry appears in the
Entries to be added box, click OK.
To add entries by typing the names, on the Type tab, in the Type the names
box, type the names of namespaces, groups, roles, or users in the following
format, and then click Add:
namespace_name;namespace_name/group_name;namespace_name/role_name;
namespace_name/user_name;
When the entries appear in the Entries to be added box, click OK.
9 of 19
COGNOS – Best Programming Practices
8. For each entry in the list, in the box next to the list, select or clear check boxes to
specify what type of access you want to grant or deny. To remove access to a user,
role or user group, remove the user, role or user group from the security list of
that object instead of checking the “deny” box. This is recommended because deny
always takes precedence than grant and hence use of deny option makes
maintenance difficult.
9. Click Apply.
In the Permissions column, an icon appears next to the user, group, or role. This icon
10. If you want to replace the existing permissions of the child entries with the
permissions you set for this entry, in the Option section, select the Delete the access
permissions of all child entries check box.
This option appears only with the entries that are containers.
8.2 Configurations
8.2.1 Drivers
Check for the Drivers for the Data Sources. Use Native drivers where possible
instead of ODBC drivers. Use Cognos Connection> Directory> Data Sources to
add the Data Sources. This would be required for the Reporting Databases.
Ensure owner of the Data source.
The highest level of data level security is set at the Data Source level. By applying
security at the Data Sources, we can restrict access of Data Sources. But this
level of security is recommended only for highly secure environments and not
for normal environments.
Roles are required for very large User Groups. For small number of users User
Group creation would be enough.
Create User Groups based on the type of Business User e.g., Finance, Sales etc.,
This can be used to implement the data level filters. This way data of one group
may be available only to one user group.
10 of 19
COGNOS – Best Programming Practices
Cognos connection is also used to schedule running and bursting of reports and
jobs. If a user account is used for this, the schedule is active as long as the user is
active. In the event of deletion of the user’s account, the schedules associated
with that user id are deactivated by default. To avoid this, the use of a service
Cognos account is recommended to set up schedules and jobs.
Create a distribution list based on the Report Names or the type of users groups
so that maintenance and usability is proper. Use Cognos Connection> Directory>
Distribution lists and contacts. The UserName and email address can be
configured here.
8.2.4 Printer
Configure the printers with proper names and access permissions. Use Cognos
Connection> Directory> Printers
Query Studio is the ROLAP ad hoc reporting tool for Cognos 8, the Web-based
reporting solution. In Query Studio, you can
• View data
Connect to an existing package to view data in a tree hierarchy. Expand the query
subjects to see query item details.
• Create reports
Use the data source to create reports, which you can save and reuse. You can also
use an existing report to create a new report.
Improve the layout of your report. For example, you can create a chart, add a title,
or reorder columns for easy comparison.
11 of 19
COGNOS – Best Programming Practices
In Query Studio, reports always use the most recent version of the package. If the
package is republished, you are notified that the report will use the newest version of
the package. You must save the report to complete the update.
In Report Viewer, if you open a saved report after the package it is based on is
republished, one of two things happens:
• If the original version of the package still exists, the report runs against the
original version.
• If the original version of the package no longer exists, the report is updated to
run against the most recent version.
Preview mode improves the report performance only if the data modeler
defines one or more design mode filters in the Framework Manager project.
Design mode filters restrict the amount of data that a preview report retrieves
to a predetermined limit.
When you use this command, remember that the data retrieved in preview
mode is not complete. The accuracy of the data returned is limited to the
number of preview rows predefined in the model. For example, summarized
values will be incorrect because they do not include all of the data.
When a preview uses limited data, a torn border appears at the top and bottom
of your report as a visual reminder that you are not using the entire data source.
12 of 19
COGNOS – Best Programming Practices
your report as a visual reminder that you are not using the entire data source.
When you preview reports with no data, you do not use the data source at all.
Artificial data replaces the numbers and characters from the data source. None
of the data is correct.
When you filter on details, you filter the values that appear in the detail rows of
your report. A filter or combination of filters can be created in Query Studio
reports. These filters can be set to prompt for values every time the report is
run.
When you filter on summaries, you filter the values in the footers. Filtering on
summaries eliminates groups from your report.
Create custom groups to produce a new report item containing values that are
meaningful to you. Use custom groups to
• convert a list of numeric results into broader categories. For example, break
down sales results into Low, Medium, and High.
• reduce the number of values into a smaller, more meaningful set .For
example, change a list of employees into My Team and Others.
Steps
2. Click the heading of the report item for which you want to create a custom
group.
13 of 19
COGNOS – Best Programming Practices
In the New range name box, type a name. In the From and To boxes,
specify the criteria you want, and click the arrow link to add to the
Ranges (in sequential order) box.
5. In the Item name box, type a name for your report item.
6. Click OK.
Report Studio is a Web product for creating reports that analyze corporate data
according to
specific information needs. This tool provides options for customizing and formatting
data to great extent. Report Studio reports can be burst and scheduled to run at required
frequencies.
10.1 Planning Reports
Before you use Report Studio to design and create a report, some information is
required. For each report, answer the following questions:
14 of 19
COGNOS – Best Programming Practices
Determine what goes into the page header, body, and footer. The page header
contains information that appears at the top of each page. The page body contains
information that starts on the first instance of the page and continues across all
instances of the page, in the case where there is too much data to fit on a single
page. The page footer is similar to the page header, except the information appears
at the bottom of each page.
Look for natural horizontal bands of information running across the page. Each of
these typically translates into a block.
Within each horizontal band of information, look for vertical bands that run up and
down the page. Each of these typically translates into table cells.
Determine whether a list, crosstab, chart, repeater, or text frame should be used to
lay out the data.
10.2.1 Guidelines
To work efficiently in Report Studio, follow these guidelines when laying out
reports:
When you set properties at the highest level, you set it once instead of having to set
them for each child object. For example, if you want all text items in a report to
appear in a specific font, set the font for the page.
Do not use fixed object sizing unless it’s absolutely necessary. When you specify that
an object have a fixed size, your layout becomes less flexible.
Steps
15 of 19
COGNOS – Best Programming Practices
3. Drag Table to the report. The Insert Table dialog box appears.
4. In the Number of Columns and Number of Rows boxes, type the number of
columns and rows you want the table to have.
5. To have the table span the width of the report page, select the Maximize Width
check box.
6. To add borders to the table, select the Show Borders check box.
7. Click OK.
If you add an overall header or footer to a list, the header or footer is a container in
which you can add objects like text and images. In addition, the containers
themselves can be modified. You can
Split a container into multiple cells that span the report (Structure menu, Split
List Row Cell)
Merge multiple cells, with the (Structure menu, Merge List Row Cells)
Add rows to a container (Structure menu, Insert List Row Cells Above and Insert
List Row Cells Below)
Steps
2. Click a column. If you have a list and you grouped one or more columns, you can
also add grouped columns as headers and footers.
5. To add or remove overall headers or footers in a list, from the Structure menu,
click List Headers & Footers, and select or clear the appropriate check boxes.
Create a Calculation
Create a calculated column to make a report more meaningful by deriving additional
information from the data source. For example, you create an invoice report, and
16 of 19
COGNOS – Best Programming Practices
you want to see the total sale amount for each product ordered. Create a calculated
column that multiplies the product price by the quantity ordered. There are two
types of calculations, Query calculation and Layout calculation. Layout calculations
are used for manipulation of dynamic information like prompt values and page
numbers.
Steps
3. Drag the Query Calculation or Layout Calculation object to the location where you
want to create a calculation. The Create Calculation dialog box appears.
6. Click OK.
If you want to include query items not shown in the report, in the Model
tab, click query items.
If you want to include query items that are in the report but not necessarily
in the model, such as calculations, in the Query Items tab, click query items.
17 of 19
COGNOS – Best Programming Practices
User the formatting standards for each of the below reporting entity. Strictly avoid developers
from specifying values for each cell or entity. Let the Developers select the Reporting Entity
from the Class property which can be later changed globally through the XSL.
The Query tab provides options to arrange and define associations between queries. Queries
are containers for holding data items, report level query calculations and filters. If using a multi
dimensional data source, slicers in queries can be used to provide dimensional filters on
measures.
Set the Aggregate, Rollup Aggregate and Presort properties for data items as
needed.
Arrange data items in the order of grouping needed. Identifiers and attributes
need to be placed above measures.
For calculations that do not use measures, set the aggregate and rollup
aggregate properties to None or Automatic. Text and string values can have this
property set to None while data fields can have these properties set to
Automatic.
Arrange filters such that data is retrieved quickly. For example, filters on
dimensional tables can be placed before filters on fact tables.
18 of 19
COGNOS – Best Programming Practices
For filters using parameter values, use “in” clause for multi select prompts, and
“=” for single select prompts.
Filters using parameters associated with optional prompts should have usage
set to Optional. Else the prompt will function as a required prompt, and not an
optional prompt.
Avoid using hardcoded SQLs in queries. Instead use query items from packages
to derive full benefit of the advantages of metadata modeling Cognos provides.
Using hardcoded SQLs also makes maintenance difficult.
While combining two or more queries to form one single query, usage of outer
joins has to be minimized as outer joins slow down report performance.
19 of 19