Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Feb 8, 2023 6:18:53 AM
Apr 2, 2013 5:16:51 PM
If you have never thought about integrating predictive analytics and QlikView, may this article pique your interest on the topic. If you have thought about the potential, but do not know how to get started, may this be the motivation to start your journey.
This demo example illustrates the art of the possible around the interoperability of the R statistics engine and QlikView 11 for enabling predictive algorithms within QlikView today.
R (http://www.r-project.org/) is a free software environment for statistical computing and graphics, which supports predictive modeling and scoring. The example also introduces Rattle (Rattle: A Graphical User Interface for Data Mining using R -- http://rattle.togaware.com/). Rattle was used to create the predictive model and generate the R code implemented within the example QlikView application. The use of Rattle is not detailed here. It is left up to you to explore.
The example assumes you understand R and how to create predictive models in R and how scoring works in R. If you understand how to do those things in R and you know how QlikView works, this example should give you an idea of how:
-- all without the end user having to leave QlikView.
As in the previous example posted by Elif Tutuk, "Integrating QV with R example kit.zip" (http://community.qlik.com/docs/DOC-2975), the example utilizes statconnDCOM. A slightly different approach in this example overcomes a break in functionality introduced into that earlier example by the changing in the behavior of one of the COM API methods in the most recent releases of statconnDCOM.
The integration is done using QlikView's built-in VBScript support to interoperate with the DCOM-based API. This is just one way to integrate with R. With a little research you can discover other potential opportunities for R integration (e.g., OpenCPU). Also, note that R is just one such example of a statistical engine being integrated with QlikView. Other solutions, such as commercially available statistical engines or predictive scoring engines may also be integrated in similar ways.
To get started with this example, save the attached file, QlikView-R_Predictive_Demo.zip, to your system. Open the zip file, and copy the enclosed folder (QlikView-R_Predictive_Demo) to a location of your choice. The location is not important as the example is portable and has no dependency on being placed in a particular folder on your system. Now navigate into the folder you just extracted and find the document named “Qlikview-R Integration Demo 20170310.pdf”. Open the document and follow the instructions step-by-step.
UPDATE (May 7, 2014): I updated the installation document (Qlikview-R Integration Demo 20140421.pdf) to eliminate the RAndFriends installer as it has been unavailable for some time. This edition of the document references R 3.1.0. Hopefully the instructions will continue to be a good guide for subsequent versions as well. I will continue to monitor for changes in R, statconnDCOM and other R components which could effect how the demo application works going forward. The example QlikView application itself remains unchanged. It is a Personal Edition version, so you should be able to explore it with a licensed QlikView Desktop or the Personal Edition. Thank you for your continued feedback on this demo.
UPDATE (September 21, 2015): Everyone who has been seeing the message "The license that is embedded in this document is not valid": I attached an updated version of QlikView-R_Predictive_Demo.zip. Ensure you overwrite the old QVW with the new one in this package. That is the only change. Please forgive this looooong overdue update.
UPDATE (October 9, 2016): Updated the embedded license to work with QlikView Desktop Personal Edition.
UPDATE (February 2, 2017): Updated the embedded license to work with QlikView Desktop Personal Edition.
UPDATE (March 10. 2017): A dependency for this particular example is statconnDCOM from the team at autstat (http://www.autstat.com/). If you wish to utilize statconnDCOM, you will need to contact autstat directly and purchase a license or request an evaluation license for testing.
Hi Brian. This looks really interesting but when I get to the end, I do see the statconn splash page but also the macro window pops open again and the plots are not refreshed. Could you point me towards error logs? I'm comfortable with R and rattle but prety new to QlikView.
Many thanks,
Kendra
Hello Kendra,
Thank you for your interest in the R integration example. A couple of questions about the version of QlikView you are using and the license you have so I can try to rule out any QlikView environmental factors.
1) Which version, release and build of QlikView 11 are you using? The current version is 11.20 SR1 build 11718.
2) Are you using the Personal Edition or have you installed a license key?
Beyond the first two questions – I am curious – did you attempt to run the scoring more than once?
Logging in my example is light. There is a simple log file (R.log) in the logs folder where you installed the app.
All R.log has in it is when the last scores were retrieved, like so: “Retrieved Scores from R at 20130402200343.” Also, the results folder should have an updated file called “ExportFile_score_idents.csv”. Both are indications that R did its thing.
And you should also have the recently generated charts from R in the plots folder.
Please let me know if the communication with R is happening properly in your environment. If the macro editor (Edit Module window) continues to pop up, I am happy to help troubleshoot further.
Best Regards,
-Brian
Hi Brian
I'm using an evaluation copy of QlikView, the version is 11.00.11282.0 SR1 and yes, I poked around for a while, opened and shut the app, ran scoring repeatedly and discovered the show-hide option (which I didn't see the first time).
There are files in the subfolders results, data etc but they all have modified dates of 27 Feb 2013 so I'm guessing that that's you and not me.
Kendra
Hi Kendra,
Based on the files not being created, sounds like the QlikView application is not communicating with R in your environment. That would be reasonable considering the macro editor (Edit Module window) pops open for you. Likely, the VBScript in your QlikView is unable create the R COM object in the runRScore subroutine. Let's see if we can home in on the reason for why that would be the case. More questions for you:
1) Is your OS 64-bit or 32-bit? If 64-bit, do you have the 64-bit version of R (from the RAndFriends installer) and the 64-bit version of QlikView? My development and testing was done with the 64-bit versions. These questions go to trying to determine if there is a mis-match in the bit-ness of the required components. Please ensure consistency.
2) Was the copy of R and Rattle an existing version on your system? Or did you follow my instructions and install the current releases step-by-step? If you are running older versions, I suggest following my guide and installing the current releases accordingly.
To remove the QlikView release you are on as a potential reason for the integration not working on your system, I installed the same version of QlikView (11.00.11282.0 SR1) -- 64-bit -- you are using running in evaluation mode (QlikView Personal Edition). The integration with R runs normally on my system.
I await your feedback.
-Brian
Brian, in answer to your questions:
64-bit OS
I use R and Rattle already so didn't install them from the RAndFriends package. I'm running 64-bit R 2.15.3 and Rattle 2.6.26 r77.
I've just updated my version of QlikView to be the most recent 64 bit version (although still an evaluation copy).
Still no luck with the script. 😞
Kendra
Brian, looking further into this, I suspect it is something to do with a combination of statconn and the way my version of R is installed - I think the rscproxy library is not in the conventional location plus it looks like you need a paid license to run the 64-bit version of statconnDCOM.
Not to worry - at least I know it can be done! Thanks for your help.
Kendra
Hi,
We need to find out more about this integration. I try to get it working on my machine with two different QWVs, and each is working the same: I see only macro popup and that's it. I have R installed. So, there definitely need to be better instruction how to connect these two... I am using latest client, 64bit.
Regards,
Piotr
Nice post!
I am new to Qlikview but familiar with R, wonding if anyone could help with this.
Does the R integration work with Qlikview server?
Are there any licensing issues if using the statconn in a commercial setting?
N.
Dear Moderator,
Plz upload PE enabled QV file.
BR