COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: barrysaab on 03 Apr 2011 03:58:09 AM

Title: Dynamic number of days data
Post by: barrysaab on 03 Apr 2011 03:58:09 AM
How could i give option to user to choose data for dynamic number of days,such as if user choose the data for 35 days or42 days etc.The data for that number of days should be displayed.Thanks
Title: Re: Dynamic number of days data
Post by: karthikeya on 04 Apr 2011 12:14:02 AM
hi barrysaab,
will you please post your requirement clearly,
with out start date and end date how could the database retrive data if you simply give 30 days or 40 days as your input.
there should be an interval prompt that too the user should give the start date and end date.
Title: Re: Dynamic number of days data
Post by: barrysaab on 04 Apr 2011 12:31:17 AM
Thanks,karthikeya.You are quite right,i will go with your suggestion.
Title: Re: Dynamic number of days data
Post by: cognostechie on 04 Apr 2011 02:23:05 AM
Quote from: barrysaab on 03 Apr 2011 03:58:09 AM
How could i give option to user to choose data for dynamic number of days,such as if user choose the data for 35 days or42 days etc.The data for that number of days should be displayed.Thanks

Here's one way -

Create a Text Box prompt and name the parameter pDate.
While creation, check out the box that says 'Create Parameterised filter'.
Make sure to allow only numeric values in the prompt (it's a property of the Prompt).
Add a filter to the query and use this kind of expression:

[Date] >= _add_days(current_date,0 - ?pDate?) and
[Date] <= _add_days(current_date,0)