QlikView and Python Integration

    Python is a very popular scripting language and below explains how to implement Python into QlikView by using the edit module.

    In the below example, we will be returning operating system info by using Python’s platform module. First, we need to create our py (Python document):

    python.PNG

    Since this document is intended for audiences who are familiar with Python, I won’t be going through what the above Python code does, but in a nutshell we are creating a class and defining all necessary attributes and a function in order to use it via VBS. After that, we will need to save this document in a folder. I saved this as OperatingSystem.py on my desktop for the demonstration purpose and executed it on cmd:

    cmd.PNG

    As you can see, all the function that is defined within the class is registered, and available as a Windows library. Now the fun part, writing a macro in QlikView. Let’s bring the edit module window and type the below script which will display a message box with the operating system info:

    editmodule.PNG

    And then assign this macro to a button. Let’s test if the script is working:

    qlik.PNG

    If you have any questions, please don’t hesitate to contact me.

     

    Happy scripting.

     

    Required Python Modules:


    win32com – This is an external module called Pywin32 that needs to be downloaded

    Pythoncom – This module comes with Python