Monday, June 25, 2012

How to achieve dynamic operator using Cognos Macros in report studio

Context
Even though macros are often considered a Framework Modeler's tool, they can be used within Report Studio as well.  We won't find the macro functions and their details within Report Studio environment (which is strange, as it fully supports them).  This way is really open a door for us to make reports to achieve some sophisticated functionalities, such to allow user to select operators.  Even it is limited function in Macros, it gives us another tier to parser statement into the really report definition with the magic ##.

Detail implementation with operators

  1. Build a prompt with static choices




2) Use it in detail filter

3) It is not limited with sample above; it can do things such as

  • Using prompt macros in native SQL, especially for relational package
  • Making prompts optional
  • Adding a token macro
  • Using prompt and PromptMany macros in query subjects
  • Showing the prompts in a report based on security

No comments:

Post a Comment