Conditional Formatting in Cognos 10
Conditional Formatting in Cognos 10
Conditional Formatting in Cognos 10
Introduction
You may utilize blocks to add backgrounds such as
a company logo or company color. Conditional
formatting is useful to highlight important
information.
Blocks
Block
A container where other objects are inserted
Useful when the business wants to see their logo or company color in a report
Conditional Styles
Specifies conditions and styles for an object
Useful when the business needs to easily identify key information
Conditional Block
A block used for conditional display, utilizing variables
Useful when you have one report with multiple options: i.e. run all data, run specific data, run specific pages, etc
Classes
Specifies a class to apply to an object
Useful when you have many objects that utilize the same format; may be reused on different objects within the report
Scenario
The company requires that all reports contain their
company color of green in the background
A Block is needed
Step One
Step Two
Background Color
Foreground Color
Uses a custom color
In order for the report to page break by Branch Code add a Page Set : Add the Inventory Query
and set Grouping & Sorting; sort by Branch Code and add Product Line to the Detail Sort List
Step Three
Anytime you are using conditional styles, adding
classes will be helpful.
You might receive additional requirements where the same
formatting that you have already used is needed on a
different column or columns. Also, if you have applied the
same format for multiple columns, then receive instructions
to change the format, update the class and anywhere that the
class has been utilized will be updated.
Add Classes
Open the View menu and select Classes
Drag a Class to the Local Classes section
Set the Class Properties
Add a Label
Set the Background Color
Set the Foreground Color
Set the Font
Step Four
Add conditional styles to satisfy the requirement to change the font color based on the % of
Change
Select the % of Change column, including the total
From the Properties - Crosstab Intersection, select Conditional Styles
Click on the New Conditional Style icon and select New Conditional Style
Select the % of Change data item from the list
Change the Type of conditional style to Numeric Range
Step Five
New Requirement
You receive a new requirement to allow the
consumer to either run the entire report or to
select the Branch Code and Product Line
You will need to add a Conditional Block,
variables, prompts, and a prompt page
Navigate to the Inventory Query and add optional prompts for Branch Code and Product
Line
Navigate to the Report Page and add a Conditional Block just under the existing Crosstab
We will add information to the Conditional Block after we set up the prompt page, including a variable
From the Page Explorer select Prompt Pages and add a Page from the Toolbox
Open the page you just added and format the page
Add a title to the page
Add a value prompt for the Output Type
Enter a Parameter name and click finish
Set the Static Choices
Add a String Variable
Define the Properties
Add a Conditional Block just under the Select Output Type Value Prompt
Select the Conditional Block and set the Block Variable to str_Output Type variable
Set the Current Block to Specific Branch/Product
Add Value Prompts for the Branch Code and Product Line
Test the report by running for the Entire Report and by Specific Branch/Product to ensure
the report is working properly
Q& A