Tuesday, 19 November 2013

How to Use a Prompt Macro to Dynamically Select a Database Table


In Framework Manager, embed a prompt macro at the data item level in a Model Query Subject.
Eg:
DB Table1 = [Year 2009]
DB Table2 = [Year 2008]
Both tables have a 'Key' column and a 'Month' column.
1) Using one of the tables, create a model query subject.
2) Edit the data item definitions of the model query subject to have the following syntax.

#'[OrclYears].[Year ' + prompt('year','token','2008') + '].[MONTH]'#
#'[OrclYears].[Year ' + prompt('year','token','2008') + '].[KEY]'#

3) Create a report which uses the 'year' parameter.
Attached is a sample model and report which demonstrates this.


No comments:

Post a Comment