QlikView Triggering EDX Enabled Tasks
QlikView Event Driven Execution (EDX) allows you to start tasks in the QlikView Publisher using an external event as the trigger.
To set up an EDX task, you must use the QlikView Management Service API (QMS API). The user making the request calls must be a member of the QlikView Administrators local group or of the QlikView EDX local group. The QlikView Administrators group is created during the installation of QlikView Server, but the QlikView EDX group must be created manually in Computer Management. Members of the QlikView EDX group can only trigger EDX-enabled tasks.
Creating the QlikView EDX group
Do the following:
- Open Local Users and Groups from Computer Management.
- Expand the group section and in the toolbar select Action > New Group...
- Enter "QlikView EDX" as the group name and select Create.
Creating an EDX task
To create an EDX task, use the following signature:
Parameter | Purpose |
---|---|
guid | ID of the QlikView Distribution Service (QDS) where the task is defined. |
taskNameOrId | Task name or ID of the task in string format. |
password | Password (if required by the task). |
variableName | Variable name (if required by the task). |
variableValues | List of values for the variable. |
The returned result contains information on whether the task was successfully started or not.
The example below shows how to trigger a task and wait until it has finished or until a certain amount of time has passed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using QMSAPI;
class Program
{
static void Main(string[] args)
{
try
{
// create a QMS API client
IQMS apiClient = new QMSClient();
// retrieve a time limited service key
ServiceKeyClientMessageInspector.ServiceKey =
apiClient.GetTimeLimitedServiceKey();
if (qdsService != null)
{
//Trigger the task
TriggerEDXTaskResult result =
apiClient.TriggerEDXTask(qdsService.ID, "PauseEDX", "edx", "", new List<string>());
EDXStatus executionStatus = null;
//wait until the task is completed or 60 seconds has passed.
SpinWait.SpinUntil(() =>
{
System.Threading.Thread.Sleep(1000);
Console.WriteLine("Checking the task...");
//Get the current state of the task.
executionStatus =
apieClient.GetEDXTaskStatus(qdsService.ID, result.ExecId);
//Return true if the task has completed.
return executionStatus !=
null && executionStatus..TaskStatus == TaskStatusValue.Completed;
}, 60 * 1000);
//write the result
if (executionStatus != null)
Console.WriteLine(executionStatus.TaskStatus);
}
}
catch (Exception ex)
{
Console.WriteLine("An exception occurred: " + ex.Message);
}
//wait for user to press any key
Console.ReadLine();
}
}
The example comes from the QMS API documentation, which is installed as part of the QlikView Management Console (QMC). It contains detailed information on the available methods and how to get started with the QMS API.