Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to call RScript function in an extension

Looking for advise on how to call an RScript in an extension backend. I have configured R with Qlik Sense and the script gets called successfully from front end.

Extension Functionality - When user clicks on a button, the extension should dynamically create an QHypercube (internally call R Function) and display its output.

Below is my code

controller: ['$scope', function ( $scope ) {

var app = qlik.currApp();

$scope.checkIfButtonPressed = function($event){

          app.createCube({

               qDimensions:[],

                   qMeasures:[{

                         qDef:{

                           qDef:"R.ScriptAggr('count(q$survived);',survived)"   //-- this doesnt give any output

                         //qDef: "count(survived)"   --this works

                         }

                    }],

                    qInitialDataFetch:[{

                         qHeight:20,

                         qWidth:2

                    }]

                    },function(reply){

                         alert(reply.qHyperCube.qDataPages[0].qMatrix[0].qNum);

                    }

               });

     }

}

Thanks,

Hari Krishna

1 Reply
Anonymous
Not applicable
Author

I figured it. Calling R from hypercube works, I was using count() function which has to be len() in R. I could see data being sent to RServe and the communication happening. Thanks