You are on page 1of 17

Proven Practice

Report Studio Workshop - Shared


Layout Components
Product(s): IBM Cognos 8
Area of Interest: Report Design

Report Studio Workshop - Shared Layout Components

Copyright
Copyright 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC
is an IBM Company. While every attempt has been made to ensure that the
information in this document is accurate and complete, some typographical
errors or technical inaccuracies may exist. Cognos does not accept
responsibility for any kind of loss resulting from the use of information
contained in this document. This document shows the publication date. The
information contained in this document is subject to change without notice.
Any improvements or changes to the information contained in this document
will be documented in subsequent editions. This document contains
proprietary information of Cognos. All rights are reserved. No part of this
document may be copied, photocopied, reproduced, stored in a retrieval
system, transmitted in any form or by any means, or translated into another
language without the prior written consent of Cognos. Cognos and the
Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated)
in the United States and/or other countries. IBM and the IBM logo are
trademarks of International Business Machines Corporation in the United
States, or other countries, or both. All other names are trademarks or
registered trademarks of their respective companies. Information about
Cognos products can be found at www.cognos.com
This document is maintained by the Best Practices, Product and Technology
team. You can send comments, suggestions, and additions to
cscogpp@ca.ibm.com .

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

Contents
1

INTRODUCTION ............................................................................................ 4

1.1
1.2
1.3

PURPOSE ............................................................................................................4
APPLICABILITY .....................................................................................................4
EXCLUSIONS AND EXCEPTIONS ..................................................................................4

BEHIND THE SCENES .................................................................................... 4

LAYOUT COMPONENT LIBRARY.................................................................... 5

USING THE SHARED LIBRARY OBJECTS ....................................................... 7

RUN-TIME UPDATES ................................................................................... 11

MANUAL UPDATES ...................................................................................... 12

CASCADING REFERENCES........................................................................... 14

SHARED LAYOUT COMPONENT AND TEMPLATES ....................................... 16

CONCLUSION .............................................................................................. 17

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

1 Introduction
1.1

Purpose
IBM Cognos 8 introduces a new capability for Layout Component References.
In IBM Cognos ReportNet 1.x these objects would allow an author to reuse
objects within a single report. IBM Cognos 8 extends this capability and
allows objects to be reused among many reports rather than just the current
report.
This document illustrates the use of the layout component reference and
identifies the methods available for updating the layout objects obtained from
other reports.

1.2

Applicability
The ability to reference other reports for layout components was introduced
with IBM Cognos 8.

1.3

Exclusions and Exceptions


The layout component reference refers to a single stand-alone layout object.
Objects from other sections of a report such as queries and conditional
variables are not included in the layout component reference definition. For
example if a table is shared via a layout component reference then
conditional formatting applied to the table from outside data items will not
operate.

2 Behind the Scenes


Behind the scenes the XML specification of the object is copied from the
source report to the target report for each layout component reference.
Therefore, you must be sure the Layout Components Reference object is
useable by itself as external references will be lost.
There




are really three elements involved in this process.


There is the report that contains the shared layout objects.
There is the report that uses the shared layout objects.
There is the Report Studio cache of the shared layout objects.

The cache contains the definitions of the shared objects. When you open a
report that contains Layout Components Reference objects, the report(s)
containing the shared layout objects is opened and the definitions are copied
into the Report Studio cache.
Why are they cached and not placed directly into the report? Because it is up
to the author to determine if copies of the shared layout object definitions are
kept in the report or if the definitions are loaded only when the report is run.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

The report author can manage the cache through the /Tools/Layout
Component Cache dialog:

In any case, this dialog will tells you that the current report Order Method
Report uses shared layout components from the Layout Library.

The
button is used to refresh the cache in other words go
back to the source reports and get the latest shared layout component
definitions.

The
button is used to refresh the copies of the
shared layout component definitions held in the current report.

3 Layout Component Library


Lets create a report just for the purposes of having shared components. We
wish to create a shareable standard page header.
Now, page headers themselves are not layout components they are part of
the page structure; we cannot share the page header directly. Instead, we
will create a table (or, you could use a block or other object that meets your
needs) to be shared instead.
We want the report title to be customizable by the user of this standard page
header.
Open Report Studio with the Great Outdoors Sales and Retailers package1
and create a new blank report.

This is a sample package provided with IBM Cognos 8. This package can be installed for you
by an administrator.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

The table we are going to share can be anywhere in the report. It does not
have to be in the page header.
Create a 1 row by 3 column table:

Select the table and set the Name property to Standard Page Header.
Drop an Image object into the left most cell. Set the image URL to
..\samples\images\logo_cognos.jpg:

Drop a text item into the center cell:

We will not place any text into this text item.


Select the new Text item.
Set the Name property to Report Title.
Place a 2 row by 1 column table into the right most cell:

Drop a Layout Calculation object in the top cell and set the expression to
AsOfDate().
Drop a Layout Calculation object in the top cell and set the expression to
PageNumber():

Save the report as Layout Library.


Note that you can create an arbitrary number of shareable components within
a single report and use these components in other existing reports by simply
giving assigning a value to the Name property.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

Close Report Studio.

4 Using the Shared Library Objects


Open Report Studio with the GO Sales and Retailers package and create a
new list report.
Select and delete all items from the Page Header:

Drop a Layout Component Reference object into the Page Header.


Note that the Component Reference dialog allows you to select components
from within the current report or to browse for another report.
Select Another Report and then browse and select the Layout Library report
that was created earlier.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components


Select the Standard Page Header object and click OK.

The icons beside the components tell you what object type they are table
and text objects in this example.
The page header (table) appears in your report:

We now want to set the report title.


Select the Standard Page Header object and select the Overrides
property.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components


Select Report Title and click OK:

Note that the report title text object has been removed from the report. You
can now drop another object in its place.
Drop a text item into the title area and set the text to Order Method Report:

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components


Set the Font to Arial 22:

Lets add some data to this report.


Add the following columns to the list:
 \Orders\Order method
 \Orders\Quantity:

Run the report and you will see the standard page header applied.

Save this report as Order Method Report. You will need it again.

IBM Cognos Proprietary Information

10

Report Studio Workshop - Shared Layout Components

11

5 Run-Time Updates
Open the Order Method Report you created in section 5.
Select the Standard Page Header Layout Component Reference object in the
report.
Note the Embed property. This property determines if the definition of this
object is to be updated each time the report is run or only when the author
decides to refresh the object in Report Studio. By default, the Embed
property value is Reference. This means a reference to the shared object is
maintained and the definition will be updated automatically each time the
report is run. Lets see that in action.
Close the Order Method Report and open the Layout Library report.
Switch the positions of the date and page number items as so:

Save and close this report.


Go to Cognos Connection and run the Order Method Report:

Note that the change to the page header has been picked up automatically
without having to edit the report in Report Studio.
Return to Report Studio and open the Order Method Report.
Note that the change to the page header has also been picked up
automatically in Report Studio.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

12

6 Manual Updates
If you do not want the updates to the Shared Layout Component updated
automatically, set the Embed property to Copy.
With the Order Method Report open, select the Standard Page Header object.
Set the Embed property to Copy and then save and close the report.
Open the Layout Library report and switch the positions of the image and
embedded table as so:

Save and close this report.


Go to IBM Cognos Connection and run the Order Method Report.
Note that the change to the page header has not been picked up.
Return to Report Studio and open the Order Method Report.
Note that the change to the page header has not been picked up:

In order to see the latest update to the Standard Page Header object you
have a few options.
When you set the Embed property to Copy, Report Studio actually copied the
definition of the Standard Page Header object into Order Method Report and
saved it. It uses this copy rather than the original at run time.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

13

When you set the Embed property to Reference, Report Studio loads a copy
of the Standard Page Header dynamically each time the Order Method Report
is opened or run but does not save it.
Select the Standard Page Header, right click and select Update Component
Copy. The change is instantly visible:

You have now manually updated the object definition and will see the latest
page header.
Select the \Tools\Layout Component Cache menu option and click on the
Layout Library report:

This dialog tells you which reports use which objects and the source report
for each. You can update the Report Studio cache for all or specific reports.
Close this dialog.
Select the Standard Page Header object and set the Embed property to
Reference.
Save the report.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

14

7 Cascading References
So far we have seen only two reports being used. You can also have
cascading references. Lets give it a try.
Open Report Studio with the GO Sales and Retailers package and create a
new blank report.
Drop a text item into the report with the text Confidential: This information
is confidential and subject to release restrictions.
Select the text object and set the Name property to Confidential Warning
Text
Save this report as Standard Text.
Open the Layout Library Report.
Select the center table cell:

Select the parent Table Row:

Select /Table/Insert Rows Below and insert 1 row:

Drop a Layout Component Reference object into the center cell of the new
row.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components


Select the Standard Text report and Confidential Warning Text Object:

Click OK to close all dialogs:

Save this report (Layout Library).


Return to IBM Cognos Connection and run the Order method report:

As you can see, the cascading references have been picked up correctly.

IBM Cognos Proprietary Information

15

Report Studio Workshop - Shared Layout Components

16

Open the Order method report in Report Studio:

Select /Tools/Layout Component Cache :

You can see the cascade of reports being used. You can also have a single
report use shared layout items from multiple reports.

8 Shared Layout Component and Templates


Of course, Shared Layout Component can also be used in templates.
Create a new list report and delete all objects from the Page Header.
Drop a Layout Component Reference object into the Page Header.
Browse and select the Layout Library report. Select the Standard Page
Header object and click OK.
Save this report as Standard Report Template.
Close this report.
Create a new report. Rather than using a blank report or any of the standard
templates, browse for a template and select Standard Report Template.

IBM Cognos Proprietary Information

Report Studio Workshop - Shared Layout Components

17

The Layout Component Reference object operates exactly as we have seen


previously.

9 Conclusion
IBM Cognos 8 provides comprehensive support for shared objects; from
shared queries in the Framework Manager model to templates and layout
objects in Report Studio.
The reuse of existing layout components will save significant development
time and allow for corporate standards to be enforced and updated
dynamically as business requirements change.

IBM Cognos Proprietary Information

You might also like