How to Create Conditional Formatting in Cognos Report Studio | A Complete Guide

Last updated on 03rd Nov 2022, Artciles, Blog, Business Analytics

About author

Samual Agastin (Tableau Sr Developer Engineering )

Samual Agastin is a Tableau Sr Developer Engineering, his role can read API products and apps, as well as edit API proxies, shared flows, and KVMs. He has 5+ years of experience in SQL Server data, MuleSoft, ESB, IBM API, AWS API RESTful, and Apache Kafka.

(5.0) | 19284 Ratings 2520
    • In this article you will get
    • 1.Why use Conditional formatting?
    • 2.Conditional formatting
    • 3.Conditional formatting – String variables
    • 4.Conditional formatting – Boolean variables
    • 5.Conclusion

Why use Conditional formatting?

Almost each object that can be used in report can have Conditional Formatting applied to it… the exceptions are some , with Singletons, Custom Controls not having feature. The most typical use for the Conditional Formatting is probably are Red/Yellow/Green formatting of values to an indicate bad/fair/good performance, but usefulness of a Conditional Formatting extends beyond this example.

Used Conditional Formatting most recently to hide a rows/columns of a Crosstab if a specific condition is met/not met, or similarly, to hide a prompt controls. Another good use is a styling within multi-dimensional authoring (such as TM1 cube) where multiple levels of hierarchy are being rendered.

Conditional formatting

Conditional Formatting is the process of formatting a business data based on given condition.Users can quickly analyse the business data by using a conditional formatting.Conditional formatting can be done with a help of the variables.There are three types of a variables – STRING, BOOLEAN, REPORT LANGUAGE VARIABLES.Variables are used to hold results of the expression.

Conditional formatting – String variables

  • Create the list report with following query items
  • An Order year, Order method, Quantity
  • Group on a order year
  • Total on a quantity
  • Go to the conditional explorer- Click on variables
  • From an insertable objects, pane drag a string variable and drop it on a variable window
  • Explain the following expression in an expression definition window
  • if ([Query1].[order year]=2004) then (1)
  • else if ([Query1].[order year]=2005) then (2)
  • else if([Query1].[order year]=2006) then (3)
  • Click on a validate- click on OK
  • Add variables 1,2,3 to a values list
  • Click on a add – give a values
  • Click on OK
  • From a page explorer,
  • Open a report page page1
  • Select a order year data item
  • From an ancestor, properties click on a list columns body style
  • From a conditional explorer,
  • Select a string variable 1
  • From a properties pane, select a style variable
  • Click on the eclipses { … }
  • Set a variable as string1
  • Select a string variable1
  • Select a font property- click on eclipses
  • Set a font size and also color
  • From a condition explorer
  • Select a string variable 2
  • Set a font size and also color
  • From a condition explorer,
  • Select a string variable 3
  • Set a font size and color
  • Turn off an explorer bar (By double-clicking) and run a report

Conditional formatting – Boolean variables

  • Create the list report with following items
  • A product line, Product type, Product name, Margin
  • From a conditional explorer click on the variables
  • From an insertable objects
  • Drag a Boolean variable and drop it on a variable window
  • Explain the following expression in an expression definition window
  • Drag a margin from available components and drop in an expression window
  • [Query1].[Margin]>0.3
  • Validate – à OK
  • From a page explorer – à Select page1
  • Select any data item in a report
  • From an ancestor select a list column body style
  • From the properties pane
  • Select a style variable property
  • Click on the eclipses
  • From a drop-down list box
  • Select a Boolean1 variable- à Click on OK
  • From the conditional explorer
  • Select a Boolean variable – Yes
  • From properties
  • Set a font property—>Click on eclipses
  • Set a font size and color
  • From a condition explorer
  • Select a Boolean variable as No
  • From properties pane—>Select a font properties
  • Set properties—> Turn off an explorer bar
  • Save & Run a report
Conditional formatting – Boolean variables

Conclusion

The user knows how to log in to the Cognos Analytics.The user has capabilities assignments necessary in a Cognos Analytics to use a report authoring.The user knows a name and location of package or data module that is available for them to the author and has adequate knowledge of this data source.