Hero Backgroud Elements 2
Reading Time: 5 Min

Integrate On-premise Servers with Analytics Designer

Learning Article
  • 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!


    Author: Jason Yang

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