COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: philelmousse on 16 Dec 2011 06:16:05 AM

Title: custome date prompt with html item
Post by: philelmousse on 16 Dec 2011 06:16:05 AM
Hello,

I would like fill my date prompt with the first day of the previous month.

I looked a script on internet and add something like that in my prompt page

<script type="text/javascript">
var today = new Date();

var first = new Date(today.getFullYear(), 0, 1);

var strYesterday = [today.getUTCFullYear(), first.getMonth()+1, first.getDate()].join("-");

genSelectDateHTML("promptDate_from", 'formWarpRequest', "P_Date_from", 'XML', "", strYesterday, , 'Gregorian', 'editBox', 'editBox', , "", "", 1, RANGE_EQUAL_VALUE, true, false, false, false, false, false, "", "", "", "", "", "");
</script>


But it doesnt work I still have the current date in the prompt. Do you have an idea of the issue ?

Thanks
Title: Re: custome date prompt with html item
Post by: kattaviz on 20 Dec 2011 11:17:11 AM
Hi,

If that is the case why not use "_first_of_month (_add_months (current_date,-1))" as a filter expression.

The above expression will always give the First day of previous month.