Showing posts with label Cognos. Show all posts
Showing posts with label Cognos. Show all posts

Monday, July 21, 2025

Cognos report, how to count double items in a list?

Create a Data Item 

count ( [item] for [item] ) 


The amount of appearances of [item]  in the list is counted.

Item   count
A        2
A        2
B        1
C        3
C        3
C        3

Tuesday, September 08, 2015

How to search for % in a string in Cognos Report Studio

If you need to search in a report for % it will not work. The % character is reserved in SQL.

The solution is to use \% (Backslash Percentage)



Thursday, February 13, 2014

How to concat in Cognos report studio, blank / null problem Oracle


In certain reports, either data contains null values or the results of a complex query can return null values.
When performing a calculation, null values will cause the calculation to return a null value.
When concatenating names consisting of  surname, prefix and initials if one of the 3 is missing the result is a complete blank.

In most cases this may not be the desired result.

Only Oracle databases have this problem, other databases work fine.
IBM states its Oracles fault because Oracle does not do standard SQL.

One of the solutions is to change the data-items you want to concatenate so that a value is returned if the field is a blank. Here is an example:

[DATABASE].[EMPLOYEE].[PREFIX]


Change the above data-item into:
if
( [DATABASE].[EMPLOYEE].[PREFIX] is  NULL)
then
(  '  ' )
else
( [DATABASE].[EMPLOYEE].[PREFIX] )

Or change the above data-item into:
coalesce (  [DATABASE].[EMPLOYEE].[PREFIX] ; '  ' )



Do this with all the fields that may contain any blanks or null values in the whole Oracle database.
After this is done it is finally possible to concatenate the several database-fields in Oracle even if one field is NULL or blank.

Tuesday, January 14, 2014

Cognos Report Studio: How to add one title to one list.

How to add one title per list. If there are two lists in one page body the titles should appear only at the top of the list it belongs to and not at the top of any other list or page.




Under menu item View select Page Structure.
Select the list you want to add a title to. Go to properties and on Column Titles Properties change it to "At Start of Details".

 
  Add List Header to the List from menu item Structure > Header and Footers.