Upload
ignaciovlb
View
230
Download
0
Embed Size (px)
Citation preview
8/10/2019 Prompt Macro Cognos
1/13
Prompt Macros in FrameworkPrompt Macros in Framework
and Report Studioand Report StudioCognos 8Cognos 8
Rocky Mountain Cognos User GroupRocky Mountain Cognos User Group
November 5, 2010November 5, 2010
8/10/2019 Prompt Macro Cognos
2/13
Page 2
Agenda
Overview of Prompt Macro Syntax
Business Case and Sample of Prompt Macro inFramework Manager
Business Cases and Sample Prompt Macro inReport Studio
In a Data Item
In a Filter
8/10/2019 Prompt Macro Cognos
3/13
Page 3
Prompt Macro
Cognos 8.3 Documentation, 8.3 FM User Guide, Cognoise Article
Macro a dynamic object which is used to substitute the values atquery 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
8/10/2019 Prompt Macro Cognos
4/13
Page 4
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.
Order Date
Entry Date
Effective DateFact Table
Time Dim Effective
Date
Time Dim Entry Date
Time Dim Order Date Order Date
Entry Date
Effective DateFact TableTime Dim Date ?Join Date?
We looked for an approach that would have just one instance of the Timedimension in the package and prompt the user if they use the Time Dim and
Fact table with which date they want to join on.
8/10/2019 Prompt Macro Cognos
5/13
Page 5
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.
8/10/2019 Prompt Macro Cognos
6/13
Page 6
Framework Manager Prompt Macro Example
This technique involves three components:
Lookup (database) table with selection options. This must be availablein the FM model.
Parameter map converts the user selected value from the prompt list tothe data item name.
Prompt macro in the join expression in model replaces regular joinexpression.
The lookup table and parameter map arent required, but they make the
technique more user friendly and foolproof.
8/10/2019 Prompt Macro Cognos
7/13
Page 7
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.
8/10/2019 Prompt Macro Cognos
8/13
Page 8
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.
8/10/2019 Prompt Macro Cognos
9/13
Modifying the Join Expression (Building Blocks)
1. Standard Join ExpressionClick to modify join expression
[Namespace].[TIME].[Effective Date] = #prompt('Please enter join option','token')#
2. Join Expression with Prompt Macro (only)
Prompt Name token Data Type
passes value with no single quotes
8/10/2019 Prompt Macro Cognos
10/13
Modifying the Join Expression (Building Blocks)
4. Final Join Expression
[Namespace].[TIME].[Effective Date] = #$TXNJoinDateOption{prompt('Please enter join option','token',
'','','[Namespace].[REPORT_PARMS_TXN_Date_Types].[Please select a date type]')}#
Wrap a parameter map around the prompt macro
[Namespace].[TIME].[Effective Date] = #prompt('Please enter join option','token','','','[Namespace].[REPORT_PARMS_TXN_Date_Types].[Please select a date type]')#
3. Join Expression with Prompt Macro and Lookup Table (queryItem)
queryItem lookup data item for promptOptional
default value Optional
preceding text
8/10/2019 Prompt Macro Cognos
11/13
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]')#
Preceding Text Trailing Text
[Namespace].[Query Subject].[MTD Value]
User Selects MTD
8/10/2019 Prompt Macro Cognos
12/13
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
8/10/2019 Prompt Macro Cognos
13/13
Questions?
Joe Allyn
(303) [email protected]
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://www-
01.ibm.com/support/docview.wss?rs=3442&context=SS9RTN&dc=DA400&uid=swg27014543&loc=en_US&cs=UTF-
8&lang=en&rss=ct3442db2
http://www.cognoise.com/community/index.php?action=printpage;topic=9015.0