Showing posts with label Macro’s in Cognos Report Studio. Show all posts
Showing posts with label Macro’s in Cognos Report Studio. Show all posts

Sunday, 11 August 2013

Macro’s in Cognos Report Studio


The Cognos engine understands the presence of a macro as it is written within a pair of hashes (#). It executes the macros first and puts the result back into report specification like a literal string replacement. We can use this to alter data items, filters, and slicers at run time.
Here are some examples of macro functions:
1.       Prompt: [Country Name] = #prompt('Country')#.
·         Create a simple report which is having Country Name,Area Name,Project Desc and Francise columns.


·         Go to Query Explorer and open the query used by list.
·         Add a detail filter with following definition:
[Country Name] = #prompt('Country')#.
·         After running the report we can see a mandatory prompt for Country Name.
·         The report will output will be as follows


2.       PromptMany:[Area Name]  in (#promptmany('AreaName')#)

·         Create a simple report which is having Country Name,Area Name,Project Desc and Francise columns.
                  ·         Go to Query Explorer and open the query used by list.
·         Add a detail filter with following definition:
[Area Name]  in (#promptmany('AreaName')#)
                  ·         After running the report it will allow you to enter multiple values