Create a "Refresh" button in Report Studio report using Javascript - Cognos Viewer Portlet

Technote (troubleshooting)


The Javascript functions and implementation to communicate with the IBM Cognos Viewer Portlet differ from those used with the IBM Cognos Viewer HTML window.


The way Cognos communicates between the two viewer components differs.


All environments

Diagnosing the problem

When attempting to apply the Javascript commonly used to communicate with the IBM Cognos Viewer HTML window from a report, client's encounter HTML errors produced by browser.

Resolving the problem

To integrate this feature use the following:

To add a button which can be used for refreshing, add an HTML element to the report in Report Studio and copy the following code into it:


<script type="text/javascript">

function do_refresh() {
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[""]) {
preFix = fW.elements[""].value;

var nameSpace = "oCV" + preFix;
eval(nameSpace + ".getRV().RunReport()");

<button onclick="do_refresh()">Refresh report</button>


This works in the regular IBM Cognos Viewer and within a portlet.

Please note, that this is an unsupported technique. This technique uses JavaScript against underlying report objects in a IBM Cognos BI report. For this reason, there is no guarantee that reports created using this technique will migrate or upgrade successfully to future versions without requiring modifications. Any such modifications are the responsibility of the report designer.

Rate this page:

(0 users)Average rating

Add comments

Document information

More support for:

Cognos Business Intelligence
Report Studio

Software version:


Operating system(s):


Reference #:


Modified date:


Translate my page

Machine Translation

Content navigation