Pages

Search This Blog

Thursday, September 20, 2007

[Cognos] Scripts

Script for Work Wrapping
document.formWarpRequest._oLstChoicescompparam[0].text = 'All';

Script for first day of the month

var pstr1=document.formWarpRequest.elements;
var lastdate=new Date();

lastdate.setDate(lastdate.getDate()-(lastdate.getDate()-1));
var gsMonthNames = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

for(var i=0;i {
if(pstr1[i].name=='txtDateFromDate')
{
var vDay = lastdate.getDate();
var vMonth = lastdate.getMonth()+1;
var vYearLong = (lastdate.getFullYear());
var vDateString = gsMonthNames[vMonth-1]+" "+vDay+", "+vYearLong;
pstr1[i].value=vDateString;
}

}

Script for last day of the month

var pstr1=document.formWarpRequest.elements;
var lastdate=new Date();

lastdate.setDate(lastdate.getDate());
var gsMonthNames = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var gsDay=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
for(var i=0;i {
if(pstr1[i].name=='txtDateToDate')
{
var vDay = lastdate.getDate();
var vMonth = lastdate.getMonth()+1;
var vYearLong = (lastdate.getFullYear());
var vDateString = gsMonthNames[vMonth-1]+" "+gsDay[vMonth-1]+", "+vYearLong;
pstr1[i].value=vDateString;
}

}

No comments: