IBM Support

Prompt API - Auto refresh a report in the Browser / Web with a timed interval

Question & Answer


Question

How can we auto refresh a report in IBM Cognos Prompt API with a time interval ? It needs to work in the Browser / Web interfaces of Cognos Connection, the Portal Portlets and the Cognos Workspace.

Answer

NOTE : Any previous documentation using unsupported Javascript in the older versions before C10.2.x for refreshing a report in a timed manner, are obsolete for C10.2.x and higher.

This Javascript code is based on the Prompt API and is supported in IBM Cognos 10.2.x and later versions only.



Include the following JavaScript code in the HTML item in the report, it will automatically refresh the report for the defined interval.

 

<script>

   var zxzx= { };

zxzx.sendFinishAction = function()

   {

      var oCR= cognos.Report.getReport('_THIS_');

      oCR.sendRequest(cognos.Report.Action.FINISH);

   }

   // Initiate script execution

   setTimeout(zxzx.sendFinishAction, 5000);

</script>




Design comments :
Of course if your report is a large report and takes much longer than 5 seconds of run time , you need to take in account a much bigger value for Autorefresh in the Browser.

This sample of technology would not be recommended as best practice for use in long running reports , as these should be in effect Scheduled in IBM Cognos for user consumption.
Browser / Web operations are considered a more immediate operation , and users should not be put to wait for running reports , nor should portal or report "delay timers" be implemented.

[{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Software Development Kit","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.2.2;10.2.1;10.2","Edition":"Edition Independent","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSTSF6","label":"IBM Cognos Analytics"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Report Authoring v11x","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"11.0","Edition":"Edition Independent","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
24 February 2020

UID

swg21646893