COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: bluecarbon on 27 Sep 2012 12:46:23 PM

Title: Date Range and Prompt macro
Post by: bluecarbon on 27 Sep 2012 12:46:23 PM
Hi,
I have a Date range macro which supplies the To Date and From Date. Now I m planning to use the values from this macro into my SQL which is hardcoded into a Query. Please let me know how can i get the From Date(Value1) and To Date(Value2) from the Date Range prompt and use it SQL using prompt macro.
Appreciate your help on this.
Title: Re: Date Range and Prompt macro
Post by: Momin on 28 Sep 2012 04:35:31 AM
Hi,

As of my understanding ur requirement is

u have two prompts from date and todate ,  which user selects and depending upon the user selection the data has to be filtered for that period.

Suppose, if user selects  1-jan-2012 in from prompt and 27-sep-2012 in to prompt the data has to filtered for 1-jan-2012 to 27-sep-2012.If this is ur requirement the please read the following.

Take three queries Query1 for from prompt,Query2 for to prompt and Query 3 for ur actual data in whcih data has to be filtered.

take two prompts in report page.in first value prompt if u want to fix ed values to visible then use static choice.similarly for second to prompt.

and now go back to query 3.and drag a filter in filter pane.and edit defintion as follows.

date between ?parameter1?  to  ?parameter2?  .

where ?paramter1? is ur from prompt paramter value.and ?parameter2? is ur to prompt paramter value.

when user select 20-jan-2012 in from prompt this will be pased on to query 3 as ?parametr1? and  user select 20-feb-2012 in to prompt this will be pased on to query 3 as ?parametr2? and query will be fired against database to fetch that period dta.

let me know if any concerns.

Regards,
Momin.