COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: kgcognos on 05 Dec 2014 10:48:34 AM

Title: Value Prompt Default Selection
Post by: kgcognos on 05 Dec 2014 10:48:34 AM
I have a value prompt to select a month[ie January, 2014...] from the Time Dimension.
Based on the selected month, it will display TY Current Month, LY Current Month, TY YTD, LY YTD, Total LY in the report.

All is working except I cannot get the month prompt to default to "Current Month".
I tried several ways from the internet...

1. I tried using #prompt but when I select a month, the Prior Year $ is not showing up.

2. I created a Static Choice
Use
(linkmember(  firstchild(  [Sales Cube].[Fiscal Time].[Current Month].[Current Month]->:[PC].[@MEMBER].[Current Month] )   , [Sales Cube].[Fiscal Time].[Fiscal Time].[Month] ))
Display
Current Month

The Default Selection does not seem to be working using MUN for Current Month/any month or "Current Month" static choice entry
I see "Current Month" in the drop down. I can select it and report is showing fine.


3. I also tried changing the report expressions but had issues when testing the parameter value. 
if (?pSelMonth? = 'Current Month' or ?pSelMonth? = null) then 
(linkmember(  firstchild(  [Sales Cube].[Fiscal Time].[Current Month].[Current Month]->:[PC].[@MEMBER].[Current Month] )   , [Sales Cube].[Fiscal Time].[Fiscal Time].[Month] ))
else
([Sales Cube].[Fiscal Time].[Fiscal Time].[Month]->?pSelMonth?)


Please help.. Thank you in advance.
Title: Re: Value Prompt Default Selection
Post by: vamsivanka on 08 Dec 2014 09:10:24 AM
This looks promising. I didn't try.

http://www.ironsidegroup.com/2013/04/02/report-studio-cookbook-dynamic-default-prompts-done-right/
Title: Re: Value Prompt Default Selection
Post by: MFGF on 11 Dec 2014 09:25:23 AM
Quote from: kgcognos on 05 Dec 2014 10:48:34 AM
I have a value prompt to select a month[ie January, 2014...] from the Time Dimension.
Based on the selected month, it will display TY Current Month, LY Current Month, TY YTD, LY YTD, Total LY in the report.

All is working except I cannot get the month prompt to default to "Current Month".
I tried several ways from the internet...

1. I tried using #prompt but when I select a month, the Prior Year $ is not showing up.

2. I created a Static Choice
Use
(linkmember(  firstchild(  [Sales Cube].[Fiscal Time].[Current Month].[Current Month]->:[PC].[@MEMBER].[Current Month] )   , [Sales Cube].[Fiscal Time].[Fiscal Time].[Month] ))
Display
Current Month

The Default Selection does not seem to be working using MUN for Current Month/any month or "Current Month" static choice entry
I see "Current Month" in the drop down. I can select it and report is showing fine.


3. I also tried changing the report expressions but had issues when testing the parameter value. 
if (?pSelMonth? = 'Current Month' or ?pSelMonth? = null) then 
(linkmember(  firstchild(  [Sales Cube].[Fiscal Time].[Current Month].[Current Month]->:[PC].[@MEMBER].[Current Month] )   , [Sales Cube].[Fiscal Time].[Fiscal Time].[Month] ))
else
([Sales Cube].[Fiscal Time].[Fiscal Time].[Month]->?pSelMonth?)


Please help.. Thank you in advance.

The simplest way to achieve this seems to be to use a prompt macro for your calculated expression. The macro will assemble the MUN of the current month member, using $current_timestamp for the current date and the timestampmask() macro function for formatting it to fit the pattern of your Month MUN. There are a number of examples of this in posts in this forum - we can help you with the syntax but we'd need to know the exact format of one of your Month MUNs. Search for timestampmask in this Report Studio forum to see some examples.

Cheers!

MF.