COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: stancho on 16 Mar 2011 12:16:31 PM

Title: Default date prompt value for scheduler - today
Post by: stancho on 16 Mar 2011 12:16:31 PM
Hi all,

I have a report created in Report Studio.
The report requires a Date parameter. The list report in it is filtered by this parameter.
I have a scheduler and the report is executed every day.

How can I change the default value for the scheduler and
so the default value of the date to be TODAY.

I tried to set the filter optional, tried to create a data item but no success :(

Thanks,
Stanislav
Title: Re: Default date prompt value for scheduler - today
Post by: Mpotla on 16 Mar 2011 01:36:25 PM
Hi ,

This we can resolve  by combining the ParamMaps with Prompts.

1. in the Date prompts restict the maximum showing in the calneder to the current date  and use ranking on the date in descending order. then Create one data item with expression
case
when rank(item)=1 then
('Current') else
date
end
set the defaulte value to the prompt with data item calculated.

2. in FM create the paramMap with Value as Dates, Key with the above expression same as the data item created in report.

3.Now While scheduling the report set the prompt value with 'Current' which always gets the current date from the parameter map.

Hope this will help.

Regards
Mohan
Title: Re: Default date prompt value for scheduler - today
Post by: stancho on 17 Mar 2011 03:53:27 AM
Hi mohanpotla,

thanks a lot for your quick answer.

I have several questions because I couldn't manage to execute the steps above.

1. "in the Date prompts restict the maximum showing in the calneder to the current date" -
How can I do that? I am only able to change the "Last date" property of the Date Prompt to a static date (not to 'today').

2. "use ranking on the date in descending order" - Is this a property of the date prompt?

3. "Create one data item with expression " - Where should I create this Data Item? In the query of the list?

4. "rank(item)". Is this 'item'. What does this item refer to?

5. "else date". Is this "else current_date" ?

6. "set the defaulte value to the prompt with data item calculated." . It is only able to change the default value of  the data prompt with a static date?

7. What is name of the paramMap created in FM . Is it 'Current'>

8. "in FM create the paramMap with Value as Dates". When creating paramMap I can set key-value and default Value. What does it mean "with Value as Dates".

9. The same question for FM like 4. and 5.

10. "Now While scheduling the report set the prompt value with 'Current'".
I'm only able to select a Date when setting the default values for scheduling reports.
Should I just have to type 'Current' in the box of the prompt.

Sorry for these many questions!
Thanks in advance,
Stancho
Title: Re: Default date prompt value for scheduler - today
Post by: BobRed0965 on 17 Mar 2011 02:33:23 PM
Stancho,

I typically deal with this using two prompts in combination.  One Value prompt and one date prompt.

In the value prompt I put static values for relative date ranges (Today, Yesterday, This week, Last Week, This Month, Last Month, etc.).  In addition to the relative date ranges, I also include a static value in the value prompt labeled something like "Specific Date Range".

The second prompt is a standard date range prompt.  This prompt is ignored unless "Specific Date Range" is selected in the value prompt.

The query filter looks something like this:
(?SelectedRange? = 'Today' AND [data item].[date] = {Sysdate})
OR
[...Several other possible ranges...]
OR
(?SelectedRange? = 'Specific Date Range' AND [data item].[date] in_range(?DateRangePrompt?))

I hope this helps.
Title: Re: Default date prompt value for scheduler - today
Post by: PRIT AMRIT on 18 Mar 2011 04:15:47 AM
A really good one..
Title: Re: Default date prompt value for scheduler - today
Post by: stancho on 18 Mar 2011 06:40:28 AM
Thanks a lot guys.

Bob I managed to do it this way. I also set the value prompt visible = false.
It's working fine!
Title: Re: Default date prompt value for scheduler - today
Post by: barrysaab on 18 Mar 2011 11:27:34 PM
Thanks,BobRed09.Is it possible to please attach example XMl here.Thanks
Title: Re: Default date prompt value for scheduler - today
Post by: Steve on 19 Mar 2011 01:28:45 PM
Quote from: BobRed0965 on 17 Mar 2011 02:33:23 PM
Stancho,

I typically deal with this using two prompts in combination.  One Value prompt and one date prompt.

In the value prompt I put static values for relative date ranges (Today, Yesterday, This week, Last Week, This Month, Last Month, etc.).  In addition to the relative date ranges, I also include a static value in the value prompt labeled something like "Specific Date Range".

The second prompt is a standard date range prompt.  This prompt is ignored unless "Specific Date Range" is selected in the value prompt.

The query filter looks something like this:
(?SelectedRange? = 'Today' AND [data item].[date] = {Sysdate})
OR
[...Several other possible ranges...]
OR
(?SelectedRange? = 'Specific Date Range' AND [data item].[date] in_range(?DateRangePrompt?))

I hope this helps.

Really smart way Bob !
Title: Re: Default date prompt value for scheduler - today
Post by: suly on 22 Apr 2015 05:45:49 AM
Hi All,

I know that this post is very old, but a really want to use this technique with static choices without scheduling.
Can somebody explain to me in details the step for creating in_range date prompt with default choice: 7 days ago to current date?
I have date prompt [SALES(Query)].[StartDate].[DATE] in_range ?Datep? and value prompt without data item.


And know?

10x a lot!