0 Replies Latest reply: Oct 3, 2014 10:36 AM by Pieter-Jan Beyls RSS

    Integration of R in QV R

    Pieter-Jan Beyls

      Hi all,

       

      I am currently facing some challenges while creating a connection between QV and R.

      Some background info, I'm rather new in QlikView and I have only basic knowledge in R.

      I found some examples here on how to create the connection between both tools, and which is also working.

       

      However when I create a new application, just a simple one, it doesn't work like it supposed to. I believe the command 'R.EvaluateNoReturn' doesn't react.. Below you can find my code in a function that is triggered after clicking on a button.

      As expected, the screen of statConn is shown after triggering the macro script.

       

      Set v = ActiveDocument.GetVariable("vAppPath")
      CurrentPath = Replace(v.GetContent.String,"\","/")
      'Export the selected data to R
      Set MyData = ActiveDocument.GetSheetObject("DataToR")
      MyData.Export CurrentPath&"/Test/ExportDataToR.csv",",",0
      'Create a COM object representing R
      Set R = createobject("StatConnectorSrv.StatConnector")
      R.Init "R"
      R.EvaluateNoReturn "QVData <- c(1,2,3,4)"
      R.EvaluateNoReturn "write.table(QVData,'text.txt',col.names = NA)"
      'End connection with R
      R.close

       

      It should generate a new txt-file with just 1,2,3,4 in it, but it doesn't work.

      Has anyone suggestions? Are there alternatives of using 'EvaluateNoReturn'?

       

      Thank you in advance!

       

      Regards