COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: xyz on 16 Jun 2015 04:25:41 AM

Title: javascript to refresh the page once after initial load and need to set the date
Post by: xyz on 16 Jun 2015 04:25:41 AM
Hi Gurus,

I am using Cognos 10.2 version with relational model, we have a requirement to set the date prompt to current date using javascript and refresh the page once after the initial load of report viewer. We used the below javascript, we are facing issue like date prompt is not getting set with the current date as well as we are unable to refresh the page once after initial load.

<script>
var report = cognos.Report.getReport("_THIS_");

function subtractDay ()
{
var dtToday = new Date();
//var count=1;
//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("-");
//alert("Today"+dtToday );
return dtToday ;


}
alert("Before refresh");
window.onload=subtractDay();
alert("after onload");
alert(" before picker");
pickerControlToDate.setValue(subtractDay() );
alert("After picker");


//setTimeout("promptButtonFinish();",300);


</script>


Can some please help or guide/suggest, what is the condition criteria needs to be written to refresh the page only once.

Thanks & Regards,
XYZ
Title: Re: javascript to refresh the page once after initial load and need to set the date
Post by: AM on 16 Jun 2015 09:25:55 PM
you could run the initial javascript on a prompt page, then run a function to submit and advance to the report page.

Also, you could use prompt API