COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: SCI Guy on 23 Jul 2013 12:20:26 PM

Title: Auto refresh report
Post by: SCI Guy on 23 Jul 2013 12:20:26 PM
I'm using Cognos 10.1.1 and had lots of issues trying to automatically refresh a report that has one user parameter but I just wanted to refresh the report using the existing parameter value.  Forum posts only gave some info.

Here is what I did.

Add HTML item to the header, change source to report expression, and paste the following.  Note: this hard codes a 5 second refresh.  Obviously you can change the value to whatever you want.  AND IT WORKED FIRST TIME!

'<script type="text/javascript">
var intval;
    var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
    if ( !fW || fW == undefined) 
    {
        fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );
    }

    var preFix = "";
    if (fW.elements["cv.id"])
    {
        preFix = fW.elements["cv.id"].value;
    }   
    var nameSpace = "oCV" + preFix;
        if(intval!=""){
          self.clearInterval(intval);
          intval="";
      }

self["RunReportInterval"] = self.setInterval( nameSpace + ".getRV().RunReport()",'+ '5000' +' );

intval = self["RunReportInterval"];
</script>'