Using EDX in QlikView 11 - basic example

    EDX is a trigger mechanism for starting a QlikView reload or task from an external source, such as a scheduler or application. To start a task using EDX the QlikView Management API must be used and this is delivered in the form of a Web Service.  The full details on EDX in QV 11 plus a detailed example and code is available here :


    Below is a step by step simple example which may help you start to develop something for your own needs.  For this example you will require and need to be familiar with Visual Studio (the free version is fine, although the attached project is for Visual Studio 2010 pro) to write your application and you will need to under stand how to use QlikView management API. 


    Step 1 - Create a task

    First of all create the task you want to trigger, this can be any type of task and do this using the QlikView management account as normal.  For the task create a trigger, and for the type of trigger chose "On an external Event" and you need to specify a password that will be used to call the task (this isnt used anywhere else except for starting the task).  The below works both if you have a fully license Publisher but also if you just have server but the task creation screen in the QMC is slight different for each.


    Step 2 - Create your application to us the API

    We are going to use the QlikView management API to build an application that will start the task, the application itself could take any form such as web page with a button (like the attached) a command line app, a web service; whatever suits your business needs. The attached example is build as a .net web page with a button a user could click but the code can be lifted and moved to another application type. 


    Its worth point out that this is the bare essentials for using EDX, it does not include things like task monitoring or error handling,  examples of more complex features can be seeing the above referenced document.


    The attached project is pre-configured to use the QliKView Management API and below is just the code required to start a task,  refer to the documentation on how to get started with using the API as this can be a bit tricky to get used to.  I have used C# on a page and many examples will use this but you can use other languages and technologies also.


    Open the attached project and you can review the key lines in the project by looking at the following:


    First we will declare some variables we need to use,  the address of your QlikView server,  the name of your task (or its ID), and the password you specfied in the task.  Typically you would want to put these in a config file or allow them to be passed as parameters.


                string QMSURL = "http://localhost:4799/QMS/Service";

                string Taskname = "Reload of Golf Quest.qvw";

                string Taskpassword = "secret";


    Second we will need to handle the Service Keys used to talk to the API, this needs to be done to call any function in the API, refer to docs for more details on this


                QMSClient Client;

                Client = new QMSClient("BasicHttpBinding_IQMS", QMSURL);

                string key = Client.GetTimeLimitedServiceKey();

                ServiceKeyClientMessageInspector.ServiceKey = key;


    Finally the real part of the code example, calling the task.  It can be as simple as just one line as shown below or more complicated. 


                Client.TriggerEDXTask(new Guid("00000000-0000-0000-0000-000000000000"), Taskname, Taskpassword, "", new string[0]);


    Breaking this line down the function "TriggerEDXTask" has 5 parameters

    1. The GUID of the QDS - this isthe identity of the reload component in QlikView, this might be the basic one attached to a server or a full Publisher, its actually the same service.  With publisher the GUID might be something different to the blank one above however the above line should work in both cases. If you have them on different servers, or more than one publisher you need to give the full and correct GUID.
    2. Taskname or GUID - fairly self explanatory the name of the task in the QMC, or its ID
    3. Task Password is the password you specified in the task
    4. Parameter name - When starting the task you can pass a variable into the reload script if needed, ive left it blank in this example
    5. Parameter values - the values for the above.


    OK thats it, of course there is plenty more that could be done here but this is the basics. It is also possible to monitor the task for completion.



    Step 3 Security & Running your code


    To be allowed to request something from the API, the user or the code calling the function needs to run as an account with particular permissions.  These are windows permissions defined on the QlikView Server as two local groups, users must be in either the QlikView Administrators or QlikView EDX groups. The later of these is not created by default.


    Depending on what type of application you build the way the users name gets to the Management Service can vary.  If the code is built into a windows exe file this will run as the user currently logged into windows. If it runs as a web page it will by default run as the identify of the application pool in IIS depending on it is set up and this might not be correct. 


    The attached example uses imponsation, that is that the ID of the user logged into the web page will be passed along to the QlikView API.  You can see this being turn on in the web.config file with the line  <identity impersonate="true"/>.  IIS needs to be configured to allow this to work by requiring windows authentication on the page and for the application pool to run in classic mode.  In this scenario every user who might call the function needs to be in the groups mentioned above, while this is quite granular it might be administation you dont want to have. Also if the application is being called by a non-windows source such as a Unix based scheduler this may give issues.


    An alternative is to modify the code so that a single user name is used to connect to the API on the behalf of all users, of course you needs to factor in some way of ensuring only permitted users can then use the application.  To do this modify the code as follows.


    After the line Client = new QMSClient("BasicHttpBinding_IQMS", QMSURL); place the following lines


                WindowsClientCredential creds = Client.ClientCredentials.Windows;

                creds.ClientCredential.UserName = "myadminaccount";

                creds.ClientCredential.Password = "mypassword";


    This will now call the API using the hardcoded credentials, although these should be saved in a config file.




    Good luck and i hope this example helps