COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Blue on 05 Sep 2016 05:09:46 PM

Title: Can I use JavaScript in Report Studio to read and display data from a web servic
Post by: Blue on 05 Sep 2016 05:09:46 PM
G'day all

Cognos BI 10.2.2 FP5 Report Studio in a Linux environment.

I have a client who want to display near real-time data from a PI Historian data source in a dashboard created with Report Studio.
OSIsoft, the vendor for PI, has a JDBC driver for Linux but it can't be used with CBI.  We can't run CBI on a Windows Server (OSIsoft has a ODBC driver for Windows) due to IBM license restrictions (CBI is provided as a supporting program with IBM PMQ).

So I'm thinking of accessing the data via an existing PI web service.  But Report Studio can't read a web service directly so I thought maybe I could use JavaScript to read the output from the web service and display it on the dashboard alongside all the other data there (I have to use three other data sources on the same dashboard). 

Can I use JavaScript to call a web service then read and display the output?  This would be a single value but needs to be near real time.

Cheers,

Blue
Title: Re: Can I use JavaScript in Report Studio to read and display data from a web servic
Post by: AnalyticsWithJay on 06 Sep 2016 07:29:01 AM
You certainly could. I would recommend calling the jQuery library to do this, as you can make the call with only a couple of lines of code. There are many examples online. Here's a code snippet of one I found:


function callWebService()
{
   var data="test";
   $.get("http://localhost/ws/service.asmx/HelloWord", function(response) {
        data = response;
   }).error(function(){
  alert("An Error Occurred");
});

   return data;
}
Title: Re: Can I use JavaScript in Report Studio to read and display data from a web servic
Post by: Blue on 07 Nov 2016 06:55:35 PM
Thanks CognoidJay.

Since the original post the plan changed.  Now using IIB to call the PI Historian web service and load the data into a table that the dashboard will read from.

And, we've now upgraded to CA11.0.04 so jQuery is no longer supported.

Cheers,

Blue