COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: philelmousse on 03 Jan 2012 04:18:44 AM

Title: date prompt last date
Post by: philelmousse on 03 Jan 2012 04:18:44 AM
Hello,

I have a date prompt "date_from" and the last date has to be "today". Is it possible ?
Title: Re: date prompt last date
Post by: HalfBloodPrince on 03 Jan 2012 05:02:08 AM
yes try this
use this Filter

[Date_column] between ?From_date ? and SysDate()
Title: Re: date prompt last date
Post by: absriram on 03 Jan 2012 05:09:13 PM
I don't think you can set this value. What you can do is validate the date using javascript after the user has selected it.

Sriram.
http://www.cognosonsteroids.com
Title: Re: date prompt last date
Post by: philelmousse on 09 Jan 2012 10:16:49 AM
i found that script to set the default date as yesterday.

<script>
function subtractDay ()
{
var dtToday = new Date();
var dtYesterday = new Date( dtToday - 86400000 ); // 86400000 = 24 hours * 60 (minutes per hour) * 60 (seconds per minute) * 1000 (milliseconds per second)
var strYesterday = [dtYesterday.getUTCFullYear(), dtYesterday.getMonth()+1, dtYesterday.getDate()].join("-");
return strYesterday;
}
P_Date_from.setValue(subtractDay() );
</script>

P_Date_from is the name of my date prompt, but it doesnt work ?