SAP

Author

Jason Yang

Jason Yang

Jason Yang is the Product Owner in the SAC Analytics Designer development team with over 10+ years of experience in Business Analytics.

Keep in touch

Subscribe for the latest news, updates, tips and more delivered right to your inbox.

Subscribe to updates

Category

Learning

Connect with us

In this blog, I would like to share with you a generic method to integrate on-premise servers (i.e. R server) with Analytics Designer. With this, you can directly consume live data from the on-premise server directly in SAP Analytics Cloud.

Integrating an on-premise R server

In this use-case, you have an on-premise R server.  You would like to consume the output from the R server but don’t want to expose the R server to the cloud.

In Analytics Designer, we use Node.js and the Web Page Widget.  Node.js receives request from Web Page Widget then passes commands to R server. After Node.js gets the output of R server, it passes the output to the Analytics Designer Runtime.

Check out the demo recording:

In this example, we use RIO (https://github.com/albertosantini/node-rio) to pass a script call to the R server. You can also try other libraries.

Here is the code for the Node.js:

 


var rio = require("rio");

var express = require(“express”);

var app = express();

app.get(“/r”, function(req, res) {

var rfile = req.query.rfile;

rio.e({

filename: rfile,

entrypoint: “createContourline”,

callback: function(err, data) {

res.writeHead(200, {

‘Content-Type’: ‘image/png’

});

res.end(data, ‘binary’);

}

});

});

app.listen(9000, “0.0.0.0”, function() {

console.log(“Nodejs server is up …”);

});

The Node.js code receives the name of the R script file (the file in our example draws contourLines), then passes the command to R server. It then gets back the output from R server and sends the output to SAP Analytics Cloud.

Note: In the example, we use the node.js URL as the address of SAP Analytics Cloud Web Page URL, but it would have more flexibility if using the PostMessage API. To learn more about this API, you could read my another blog: Typical Patterns and Samples of Integrating Analytics Designer.

More than just on-premise R server 

This method of using node.js to sync data between the SAP Analytics Cloud and on-premise servers is generic, can be Python or others in addition to R. I hope this blog could give you some ideas when you meet similar use cases.

Enjoy your exploration with Analytics Designer!

SAP Analytics Cloud earns a top ranking from BARC

See how SAP Analytics Cloud performed in the world’s largest survey of Business Intelligence software users.