Vous êtes sur la page 1sur 13

Prompt Macros in Framework

and Report Studio


Cognos 8
Rocky Mountain Cognos User Group
November 5, 2010

Agenda

Overview of Prompt Macro Syntax


Business Case and Sample of Prompt Macro in
Framework Manager
Business Cases and Sample Prompt Macro in
Report Studio
In a Data Item
In a Filter

Page 2

Prompt Macro

Cognos 8.3 Documentation, 8.3 FM User Guide, Cognoise Article

Macro a dynamic object which is used to substitute the values at


query run time (encapsulated in # signs) .

Prompt Macro
Syntax:
prompt ( prompt_name , datatype , defaultText , text , queryItem , trailing_text)
Only the prompt_name is required, all other parameters are optional.

Sample:
#prompt('StartingCountryCode', 'integer', '10')#

* promptmany macro same syntax, provides multi-select prompt

Page 3

Framework Manager Use Case

Transactions have 3 different dates associated with them. The report


developer would like to have a Time dimension associated with all 3. Could
be modeled with 3 Query subjects, each joined to fact table. This could lead
to confusion and cluttering of the package.
The Time dimension was very important because we have a large number of
business-defined Time periods that we have flags for (Y/N values) that are
updated each day based on last loaded business date.
We looked for an approach that would have just one instance of the Time
dimension in the package and prompt the user if they use the Time Dim and
Fact table with which date they want to join on.
Time Dim Effective
Date
Time Dim Entry Date
Time Dim Order Date

Fact Table

Time Dim Date

Effective Date

Fact Table
?Join Date?

Effective Date

Entry Date

Entry Date

Order Date

Order Date

Page 4

What the Solution Looks Like

When the user runs a report that includes the Time Dim and Fact table, they
are prompted to select a date type (to join on).

Current Business Date

This can be answered at run time, in a report schedule prompt, or embedded


in a prompt page and given a default value and hidden.
Page 5

Framework Manager Prompt Macro Example

This technique involves three components:


Lookup (database) table with selection options. This must be available
in the FM model.
Parameter map converts the user selected value from the prompt list to
the data item name.
Prompt macro in the join expression in model replaces regular join
expression.

The lookup table and parameter map arent required, but they make the
technique more user friendly and foolproof.

Page 6

Lookup Table

The lookup table is used as the queryItem in the prompt macro. This
provides the end user with the choices to select from. Our table design has
three different columns for datatypes number, text and date to support
different possible prompt values.

Sample data from the report parameter table. When this table is modelled in
FM, a filter is added for the parm_type so only the relevant options are
returned to the user.

Page 7

Parameter Map

The parameter map takes the user selected value from the queryItem (key)
and converts it to the appropriate data item (value) that will be used in the
join.

Page 8

Modifying the Join Expression (Building Blocks)

1. Standard Join Expression

Click to modify join expression

2. Join Expression with Prompt Macro (only)


[Namespace].[TIME].[Effective Date] = #prompt('Please enter join option','token')#
Prompt Name
token Data Type
passes value with no single quotes

Modifying the Join Expression (Building Blocks)

3. Join Expression with Prompt Macro and Lookup Table (queryItem)


[Namespace].[TIME].[Effective Date] = #prompt('Please enter join option','token',
'','','[Namespace].[REPORT_PARMS_TXN_Date_Types].[Please select a date type]')#
Optional
default value

queryItem lookup data item for prompt

Optional
preceding text

4. Final Join Expression


Wrap a parameter map around the prompt macro

[Namespace].[TIME].[Effective Date] = #$TXNJoinDateOption{


prompt('Please enter join option','token',
'','','[Namespace].[REPORT_PARMS_TXN_Date_Types].[Please select a date type]')}#

Report Studio Data Item Example

The report allows the user to select Daily, MTD or YTD totals (for which there
are 3 different columns of data with similar names). The macro resolves the
user selection to the appropriate data item name. The prompt uses a Value
Prompt with Static Choices.

#prompt('Date Type','token','[Namespace].[Query Subject].[Daily Value]',


'[Namespace].[Query Subject].[','',' Value]')#

User Selects MTD

Preceding Text

Trailing Text

[Namespace].[Query Subject].[MTD Value]

Report Studio Filter Example

The report allows the user to select a Firm type (for which there are 3 types).
The macro resolves the user selection to the appropriate data item name in
the filter expression. The prompt uses a Value Prompt with Static Choices.

#prompt(Dealer Type','token','[Executing Firm Number])# = ?select dealer?

User Selects
Clearing Dealer
and 1234

[Clearing Firm Number] = 1234

Questions?

Joe Allyn
(303) 768-2670
jallyn@oppenheimerfunds.com

Thanks for coming today!


Additional Resources
http://download.boulder.ibm.com/ibmdl/pub/software/data/cognos/documentation/docs/en/cognos8_bi/8.3/ug_fm.pdf
http://www01.ibm.com/support/docview.wss?rs=3442&context=SS9RTN&dc=DA400&uid=swg27014543&loc=en_US&cs=UTF8&lang=en&rss=ct3442db2
http://www.cognoise.com/community/index.php?action=printpage;topic=9015.0

Vous aimerez peut-être aussi