9 Replies Latest reply: Mar 28, 2016 3:53 AM by Yakir Manor RSS

    Create ExternalProgramTask with the QMS API

    Leonardo Raed

      Hi all,

       

       

      Anyone know if it's possible create an ExternalProgramTask with the QMS API? I can't find the way...

       

       

      Thanks a lot.

      Leo

        • Re: Create ExternalProgramTask with the QMS API
          Nils Morris

          Hi,

          Do you want to trigger a QlikView task or an external program and do you have publisher?

          • Re: Create ExternalProgramTask with the QMS API
            Yakir Manor

            so you want to use edx and you dont have publisher, then this is the post for you!


            what can you even do with edx???

            you can run a reload task from a remote api or from qlikview client.

            well, for this you dont need edx!, you can create a scheduled reload and trigger it from the api (qms), but , if you want to pass parameters to that reload process and you dont have the publisher then edx is the thing for you!, or if you want to create more then one type of reload, like partial reload, then also this manual is for you

             

            the things you'll need to know (just as reference you can skip if you want):

                1. QlikView Management API (or QMS) - qlikview has created an api to use with their server, you can find the api here:

                QMS API Documentation - Version 11

                2. you can connect to the api using this link:

                QlikView Management API - Getting Started and Examples

                3. the documentation is not going to help you too much and most of what you actually want is not there,

                with that being said, you can create tasks without the Publisher.


            to create task you'll need to do those steps:

                1. connect to the QMSBackendService (you can see it in the attached code).

                2. use c# code to create the task.

                3. change the xml of the task and restart the service. (not always but its nice to know its possible)

                4. add macro to your qvw that runs exe on the server that starts the tasks.

             

            so should you buy the publisher? maybe, if you dont want all the coding hassle,
            if you decided not to buy it, just a good references to go around it can be found here:

                1. braathen/qv-edx-trigger · GitHub

                2. braathen/qv-user-manager · GitHub

                3. Using EDX in QlikView 11 - basic example

             

            so lets start,

                1. first download my code, now you need to update the service reference, or change the app.config with your server address,

                preferably, you have visual studio installed on the qlikview machine and you update the service from there.

                compile the code and put the code on the same machine as qlikview if you want to do reloads from the qlikview client,

                if you want to do reloads from some wabsite or console than just make sure the connection is working.

                2. to test for connection you can open cmd (shift + mouse right click then Open command window here)

                run: qv-user-manager.exe -l tasks

                this will show you all current tasks, (except currently running tasks).

                3. to create edx you can run the parameters:

                run: qv-user-manager.exe --document=YourDocName.qvw --action=create --type=edx

                4. now you can see the edx task in:

                QlikView Management Console -> Status -> Tasks

                you can aslo pass parameter to your load script.

                5. you can run your edx by:

                doc name and task type:

                a. run: qv-user-manager.exe --document=YourDocName.qvw --action=run --type=edx

                task name: (use "quote" if you have space in task name)
                b. run: qv-user-manager.exe --action=run --name="Edx Reload of YourDocName.qvw"

                task id (guid): (just run task list and copy-paste from the log file)

                c. qv-user-manager.exe --action=run --name=230b043c-8be3-4762-a359-8f217d600df1

                add parameter:

                just add to any of the above:

                --type=edx --variable=varAjaxReload --values=1

             

            ok, so now we have created the edx task and we know how to use it, we can use this code from a website or some private api service, but now we want to delete some service,

            important: you can see all tasks and triggers in C:\ProgramData\QlikTech\DistributionService

            but deleting the .xml from tasks or triggers will make your Distribution Service (ReloadEngine) stop working!!!

            it will not restart the next time.

             

                6.to delete a task and its trigger you can only do it using the api:

                (you can also use the 3 methods in run but its better use the name or id from the log)

                task id (guid):

                run: qv-user-manager.exe --action=remove --name=230b043c-8be3-4762-a359-8f217d600df1

                now you can also delete the task and trigger xml both are marked with the Guid, here it was:

                Task_230b043c-8be3-4762-a359-8f217d600df1.xml

                Triggers_230b043c-8be3-4762-a359-8f217d600df1.xml

             

                you can write code to delete those xml but to avoid errors i decided against it.

             

                7. now if you want to run the reload task from the qlikview client, this is basically writing a code that will run the task

                using shell command, to run the task you can see the qvw i attached, after openning it go to:

                Tools -> Edit Module...

                to see the script call.


                you also need to put the build exe file somewhere so you can call it from the macro.

             

                this will only work if you enabling the Allow macro execution on server and Allow unsafe macro execution on server on your Qlikview      Server Managment Console.


                Go to System->Setup->Qlikview Servers->Security tab.

             

                you might also need to enable macros in the document

                Go to Tools -> Edit Module -> Requested Module Security: System Access, Current Local Security: Allow System Access

             

            Epilogue

            I'll finish with the way i use it, you can see the qvw i attached, i do this for each document:

            A. qv-user-manager.exe --document=MyDoc.qvw --action=create --type=edx

            then when i want to load i implemented in my code 3 loading types:

                 0 - qvd Reload

                 1 - Regular Reload

                 2 - Incremental Reload (Incremental Load loades only the missing RecordId's)

                 3 - Dynamic load (config file setting)

            then when i want to load using only qvd i open cmd (shift + mouse right click then Open command window here) where i put all the exe of the QlikViewTaskManagement and run:

            B. qv-user-manager.exe --document=MyDoc.qvw --action=run --type=edx --variable=varAjaxReload --values=0

            or i press a button in my qvw the runs this commend (:.

             

            good luck!
            Yakir Manor

              • Re: Create ExternalProgramTask with the QMS API
                Jose Amar

                Great post Yakir, thank you very much, it really helped me!

                • Re: Create ExternalProgramTask with the QMS API
                  Abi Sig

                  Hello-

                  very helpful!!

                  In our organization there some models are created automatically at night (by dot net program),

                  As we know the each model gets its category automatically in Qlikview Management Console

                  under default category: 'default'.

                  the problem is I like to categorize the model under another category

                  name that already exists: 'sales'

                  and not through the manual way:

                  QVMC > Documents > (Select Document) > Document Information > Category

                  but I'm looking for a way  to do it by dot net code (C #).

                  I saw in the QMS API Documentation Help:

                  'Document MetaData.Document MetaData DocumentInfo.Category property'.

                   

                  •Do you know how to use the functions to change the document's category and save the change?


                  Thanks a lot,

                  Abi.