COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: david.stachon on 29 Apr 2009 04:20:38 PM

Title: Date Range Prompt OR Drop Down List (JS to reset?)
Post by: david.stachon on 29 Apr 2009 04:20:38 PM
On a prompt page, I would like to have 2 prompts which will determine my date filter...

The first,

"Relative Time Period" (optional, single-select, radio button)

...this will contain: "MTD, Last Month, Last 3 Months, etc..."

The second,

"Date Range" (optional, single select, date range)

...obviously, this is a date range prompt.

The idea is that a user will select from either "Relative Time Period" OR "Date Range".

Anyone have a javascript that will pick up if a user clicks in one, it will automatically reset the other? (I've done this before with List Boxes, but not the date range prompt object)

For example, A user selects a date range, then changes his mind and selects "MTD". I would like a script to reset the date range to "Earliest Date" / "Lastest Date".

(Version 8.4)

cheers,
david
Title: Date Range Prompt - Setting dynamic default values using Report Expressions
Post by: david.stachon on 30 Apr 2009 01:45:55 AM
Okay, I've come up with something pretty decent....

I've been able to customize some js I found in the KB.

Using dynamic JS (i.e constructed with a report expression), and utilizing report level date functions, I'm able to set dynamic default values for a date prompt.

(ultimately, it would sure be nice to set the default dates based on a query / data item, or a simple report expression)

....in the example attached, I default the "From" date to three months ago, first day of the month.

....and the "To" date to today.

Attached is the report spec. And I've documented how to use it. (inside the rich text item)
Title: Data Driven value for default dates in date range prompt
Post by: david.stachon on 30 Apr 2009 02:51:38 AM
ha! I spoke too soon.

I've attached an example of using dates retrieved from a query to set the default dates in a date range prompt.

It's similar to the example above, but much easier as you don't have to touch the javascript.